--- ibx/trunk/ibcontrols/IBDynamicGrid.pas 2016/05/17 08:14:52 40 +++ ibx/trunk/ibcontrols/IBDynamicGrid.pas 2016/07/16 12:25:48 41 @@ -167,6 +167,8 @@ end; property OnEditingDone; end; + TOnSelectPanelEditor = procedure(Sender: TObject; var aEditorPanel: TWinControl) of object; + TDBDynamicGrid = class(TDBGrid) private { Private declarations } @@ -177,6 +179,7 @@ end; FOnEditorPanelHide: TNotifyEvent; FOnEditorPanelShow: TNotifyEvent; FOnKeyDownHander: TKeyDownHandler; + FOnSelectPanelEditor: TOnSelectPanelEditor; FResizing: boolean; FWeHaveFocus: boolean; FHidingEditorPanel: boolean; @@ -224,6 +227,8 @@ end; property OnEditorPanelShow: TNotifyEvent read FOnEditorPanelShow write FOnEditorPanelShow; property OnEditorPanelHide: TNotifyEvent read FOnEditorPanelHide write FOnEditorPanelHide; property OnKeyDownHander: TKeyDownHandler read FOnKeyDownHander write FOnKeyDownHander; + property OnSelectPanelEditor: TOnSelectPanelEditor read FOnSelectPanelEditor + write FOnSelectPanelEditor; end; {TIBGridControlLink} @@ -706,6 +711,10 @@ procedure TDBDynamicGrid.UpdateActive; begin inherited UpdateActive; + if not (csLoading in ComponentState) and assigned(DataLink) + and assigned(DataLink.DataSet) and DataLink.DataSet.Active then + DoGridResize; + if not (csLoading in ComponentState) and assigned(DataLink) and assigned(FEditorPanel) and not FEditorPanel.Visible and assigned(DataLink.DataSet) and (DataLink.DataSet.State = dsInsert) then @@ -744,12 +753,18 @@ begin end; procedure TDBDynamicGrid.ShowEditorPanel; +var aEditor: TWinControl; begin if (csDesigning in ComponentState) or (DataSource = nil) or (DataSource.DataSet = nil) or ((DataSource.DataSet.RecordCount = 0) and (DataSource.DataSet.State <> dsInsert)) then Exit; - Editor := FEditorPanel; + aEditor := FEditorPanel; + if assigned(FOnSelectPanelEditor) then + OnSelectPanelEditor(self,aEditor); + if FEditorPanel <> aEditor then + SetEditorPanel(aEditor); + Editor := aEditor; EditorMode := true; end;