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 } |
179 |
|
FOnEditorPanelHide: TNotifyEvent; |
180 |
|
FOnEditorPanelShow: TNotifyEvent; |
181 |
|
FOnKeyDownHander: TKeyDownHandler; |
182 |
+ |
FOnSelectPanelEditor: TOnSelectPanelEditor; |
183 |
|
FResizing: boolean; |
184 |
|
FWeHaveFocus: boolean; |
185 |
|
FHidingEditorPanel: boolean; |
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} |
311 |
|
|
312 |
|
implementation |
313 |
|
|
314 |
< |
uses Math, IBQuery, LCLType, Variants; |
314 |
> |
uses LCLType, Variants, EditBtn; |
315 |
|
|
316 |
|
{ TIBGridControlLink } |
317 |
|
|
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); |
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 |
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 |
|
|