ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/ibcontrols/IBDynamicGrid.pas
(Generate patch)

Comparing ibx/trunk/ibcontrols/IBDynamicGrid.pas (file contents):
Revision 39 by tony, Tue May 17 08:14:52 2016 UTC vs.
Revision 45 by tony, Tue Dec 6 10:33:46 2016 UTC

# Line 167 | Line 167 | end;
167      property OnEditingDone;
168    end;
169  
170 +  TOnSelectPanelEditor = procedure(Sender: TObject; var aEditorPanel: TWinControl) of object;
171 +
172    TDBDynamicGrid = class(TDBGrid)
173    private
174      { Private declarations }
# Line 177 | Line 179 | end;
179      FOnEditorPanelHide: TNotifyEvent;
180      FOnEditorPanelShow: TNotifyEvent;
181      FOnKeyDownHander: TKeyDownHandler;
182 +    FOnSelectPanelEditor: TOnSelectPanelEditor;
183      FResizing: boolean;
184      FWeHaveFocus: boolean;
185      FHidingEditorPanel: boolean;
# Line 224 | Line 227 | end;
227      property OnEditorPanelShow: TNotifyEvent read FOnEditorPanelShow write FOnEditorPanelShow;
228      property OnEditorPanelHide: TNotifyEvent read FOnEditorPanelHide write FOnEditorPanelHide;
229      property OnKeyDownHander: TKeyDownHandler read FOnKeyDownHander write FOnKeyDownHander;
230 +    property OnSelectPanelEditor: TOnSelectPanelEditor read FOnSelectPanelEditor
231 +                                                       write FOnSelectPanelEditor;
232   end;
233  
234    {TIBGridControlLink}
# Line 306 | Line 311 | end;
311  
312   implementation
313  
314 < uses Math, IBQuery, LCLType, Variants;
314 > uses LCLType, Variants, EditBtn;
315  
316   { TIBGridControlLink }
317  
# Line 566 | Line 571 | begin
571                           and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore Return in a CustomMemo}
572  
573      if (AControl <> nil) and (AControl is TCustomGrid)
574 <                         and (Key in [VK_RETURN,VK_UP,VK_DOWN,VK_TAB]) then Exit; {Ignore Return in a CustomMemo}
574 >                         and (Key in [VK_RETURN,VK_UP,VK_DOWN,VK_TAB]) then Exit; {Ignore Return in a Custom Grid}
575 >
576 >    if (AControl <> nil) and ((AControl is TDateEdit) or (AControl is TEBEdit))
577 >                         and (Key in [VK_RETURN,VK_UP,VK_DOWN,
578 >                               VK_ESCAPE,VK_LEFT,VK_RIGHT]) then Exit; {Ignore Return in a Data edit}
579  
580      if assigned(FOnKeyDownHander) then
581        OnKeyDownHander(Sender,Key,Shift,Done);
# Line 706 | Line 715 | procedure TDBDynamicGrid.UpdateActive;
715   begin
716    inherited UpdateActive;
717  
718 +  if not (csLoading in ComponentState) and assigned(DataLink)
719 +                       and assigned(DataLink.DataSet) and DataLink.DataSet.Active then
720 +    DoGridResize;
721 +
722    if not (csLoading in ComponentState) and assigned(DataLink) and
723       assigned(FEditorPanel) and not FEditorPanel.Visible and
724       assigned(DataLink.DataSet) and (DataLink.DataSet.State = dsInsert) then
# Line 744 | Line 757 | begin
757   end;
758  
759   procedure TDBDynamicGrid.ShowEditorPanel;
760 + var aEditor: TWinControl;
761   begin
762    if (csDesigning in ComponentState) or
763     (DataSource = nil) or (DataSource.DataSet = nil)
764       or ((DataSource.DataSet.RecordCount = 0) and (DataSource.DataSet.State <> dsInsert)) then
765       Exit;
766 <  Editor := FEditorPanel;
766 >  aEditor := FEditorPanel;
767 >  if assigned(FOnSelectPanelEditor) then
768 >    OnSelectPanelEditor(self,aEditor);
769 >  if FEditorPanel <> aEditor then
770 >    SetEditorPanel(aEditor);
771 >  Editor := aEditor;
772    EditorMode := true;
773   end;
774  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines