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 217 by tony, Fri Mar 16 10:27:26 2018 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;
182    FHidingEditorPanel: boolean;
183    FAllowHide: boolean;
185      FMouseDown: boolean;
186      function ActiveControl: TControl;
187      procedure DoShowEditorPanel(Data: PtrInt);
# Line 224 | Line 225 | end;
225      property OnEditorPanelShow: TNotifyEvent read FOnEditorPanelShow write FOnEditorPanelShow;
226      property OnEditorPanelHide: TNotifyEvent read FOnEditorPanelHide write FOnEditorPanelHide;
227      property OnKeyDownHander: TKeyDownHandler read FOnKeyDownHander write FOnKeyDownHander;
228 +    property OnSelectPanelEditor: TOnSelectPanelEditor read FOnSelectPanelEditor
229 +                                                       write FOnSelectPanelEditor;
230   end;
231  
232    {TIBGridControlLink}
# Line 306 | Line 309 | end;
309  
310   implementation
311  
312 < uses Math, IBQuery, LCLType, Variants;
312 > uses LCLType, Variants, EditBtn;
313  
314   { TIBGridControlLink }
315  
# Line 563 | Line 566 | begin
566        Exit; {ignore these keys if we are in a  combobox}
567  
568      if (AControl <> nil) and (AControl is TCustomMemo)
569 <                         and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore Return in a CustomMemo}
569 >                         and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore keys in a CustomMemo}
570  
571      if (AControl <> nil) and (AControl is TCustomGrid)
572 <                         and (Key in [VK_RETURN,VK_UP,VK_DOWN,VK_TAB]) then Exit; {Ignore Return in a CustomMemo}
572 >                         and (Key in [VK_RETURN,VK_UP,VK_DOWN,VK_TAB]) then Exit; {Ignore keys in a Custom Grid}
573 >
574 >    if (AControl <> nil) and (AControl is TEBEdit) and (AControl.Owner is TDateEdit) then
575 >    begin
576 >      if (Key in [VK_LEFT,VK_RIGHT]) then Exit; {Ignore navigation keys}
577 >      if TDateEdit(AControl.Owner).DroppedDown and
578 >        (Key in [VK_RETURN,VK_UP,VK_DOWN,VK_ESCAPE]) then Exit; {Ignore TCalender navigation keys in a Data edit}
579 >    end;
580  
581      if assigned(FOnKeyDownHander) then
582        OnKeyDownHander(Sender,Key,Shift,Done);
# Line 706 | Line 716 | procedure TDBDynamicGrid.UpdateActive;
716   begin
717    inherited UpdateActive;
718  
719 +  if not (csLoading in ComponentState) and assigned(DataLink)
720 +                       and assigned(DataLink.DataSet) and DataLink.DataSet.Active then
721 +    DoGridResize;
722 +
723    if not (csLoading in ComponentState) and assigned(DataLink) and
724       assigned(FEditorPanel) and not FEditorPanel.Visible and
725       assigned(DataLink.DataSet) and (DataLink.DataSet.State = dsInsert) then
# Line 744 | Line 758 | begin
758   end;
759  
760   procedure TDBDynamicGrid.ShowEditorPanel;
761 + var aEditor: TWinControl;
762   begin
763    if (csDesigning in ComponentState) or
764     (DataSource = nil) or (DataSource.DataSet = nil)
765       or ((DataSource.DataSet.RecordCount = 0) and (DataSource.DataSet.State <> dsInsert)) then
766       Exit;
767 <  Editor := FEditorPanel;
767 >  aEditor := FEditorPanel;
768 >  if assigned(FOnSelectPanelEditor) then
769 >    OnSelectPanelEditor(self,aEditor);
770 >  if FEditorPanel <> aEditor then
771 >    SetEditorPanel(aEditor);
772 >  Editor := aEditor;
773    EditorMode := true;
774   end;
775  
# Line 978 | Line 998 | end;
998   destructor TIBDynamicGridColumn.Destroy;
999   begin
1000    if assigned(FDBLookupProperties) then FDBLookupProperties.Free;
1001 +  Application.RemoveAsyncCalls(self);
1002    inherited Destroy;
1003   end;
1004  
# Line 1270 | Line 1291 | begin
1291    if assigned(FIBControlLink) then FIBControlLink.Free;
1292    if assigned(FIndexFieldsList) then FIndexFieldsList.Free;
1293    if assigned(FDBLookupCellEditor) then FDBLookupCellEditor.Free;
1294 +  Application.RemoveAsyncCalls(self);
1295    inherited Destroy;
1296   end;
1297  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines