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 |
|
|
568 |
|
Exit; {ignore these keys if we are in a combobox} |
569 |
|
|
570 |
|
if (AControl <> nil) and (AControl is TCustomMemo) |
571 |
< |
and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore Return in a CustomMemo} |
571 |
> |
and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore keys 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 keys in a Custom Grid} |
575 |
> |
|
576 |
> |
if (AControl <> nil) and (AControl is TEBEdit) and (AControl.Owner is TDateEdit) then |
577 |
> |
begin |
578 |
> |
if (Key in [VK_LEFT,VK_RIGHT]) then Exit; {Ignore navigation keys} |
579 |
> |
if TDateEdit(AControl.Owner).DroppedDown and |
580 |
> |
(Key in [VK_RETURN,VK_UP,VK_DOWN,VK_ESCAPE]) then Exit; {Ignore TCalender navigation keys in a Data edit} |
581 |
> |
end; |
582 |
|
|
583 |
|
if assigned(FOnKeyDownHander) then |
584 |
|
OnKeyDownHander(Sender,Key,Shift,Done); |
718 |
|
begin |
719 |
|
inherited UpdateActive; |
720 |
|
|
721 |
+ |
if not (csLoading in ComponentState) and assigned(DataLink) |
722 |
+ |
and assigned(DataLink.DataSet) and DataLink.DataSet.Active then |
723 |
+ |
DoGridResize; |
724 |
+ |
|
725 |
|
if not (csLoading in ComponentState) and assigned(DataLink) and |
726 |
|
assigned(FEditorPanel) and not FEditorPanel.Visible and |
727 |
|
assigned(DataLink.DataSet) and (DataLink.DataSet.State = dsInsert) then |
760 |
|
end; |
761 |
|
|
762 |
|
procedure TDBDynamicGrid.ShowEditorPanel; |
763 |
+ |
var aEditor: TWinControl; |
764 |
|
begin |
765 |
|
if (csDesigning in ComponentState) or |
766 |
|
(DataSource = nil) or (DataSource.DataSet = nil) |
767 |
|
or ((DataSource.DataSet.RecordCount = 0) and (DataSource.DataSet.State <> dsInsert)) then |
768 |
|
Exit; |
769 |
< |
Editor := FEditorPanel; |
769 |
> |
aEditor := FEditorPanel; |
770 |
> |
if assigned(FOnSelectPanelEditor) then |
771 |
> |
OnSelectPanelEditor(self,aEditor); |
772 |
> |
if FEditorPanel <> aEditor then |
773 |
> |
SetEditorPanel(aEditor); |
774 |
> |
Editor := aEditor; |
775 |
|
EditorMode := true; |
776 |
|
end; |
777 |
|
|