91 |
|
FListSource: TDataSource; |
92 |
|
FOnAutoInsert: TAutoInsert; |
93 |
|
FOnCanAutoInsert: TCanAutoInsert; |
94 |
+ |
FOnCloseUp: TNotifyEvent; |
95 |
|
FOnDrawItem: TDrawItemEvent; |
96 |
|
FOwner: TIBDynamicGridColumn; |
97 |
|
FRelationName: string; |
118 |
|
property Style: TComboBoxStyle read FStyle write FStyle default csDropDown; |
119 |
|
property OnAutoInsert: TAutoInsert read FOnAutoInsert write FOnAutoInsert; |
120 |
|
property OnCanAutoInsert: TCanAutoInsert read FOnCanAutoInsert write FOnCanAutoInsert; |
121 |
+ |
property OnCloseUp: TNotifyEvent read FOnCloseUp write FOnCloseUp; |
122 |
|
property OnDrawItem: TDrawItemEvent read FOnDrawItem write FOnDrawItem; |
123 |
|
end; |
124 |
|
|
179 |
|
FWeHaveFocus: boolean; |
180 |
|
FHidingEditorPanel: boolean; |
181 |
|
FAllowHide: boolean; |
182 |
+ |
function ActiveControl: TControl; |
183 |
|
procedure DoShowEditorPanel(Data: PtrInt); |
184 |
|
procedure PositionTotals; |
185 |
|
procedure KeyDownHandler(Sender: TObject; var Key: Word; Shift: TShiftState); |
406 |
|
RowHeights[FExpandedRow] := DefaultRowHeight; |
407 |
|
FExpandedRow := -1; |
408 |
|
if CanFocus then SetFocus; |
406 |
– |
if assigned(FOnEditorPanelHide) then |
407 |
– |
OnEditorPanelHide(self); |
409 |
|
DoOnResize; |
410 |
|
ResetSizes; |
411 |
< |
Invalidate; |
411 |
> |
DoOnChangeBounds; |
412 |
> |
if assigned(FOnEditorPanelHide) then |
413 |
> |
OnEditorPanelHide(self); |
414 |
|
end; |
415 |
|
end; |
416 |
|
|
492 |
|
inherited KeyDown(Key, Shift); |
493 |
|
end; |
494 |
|
|
495 |
+ |
function TDBDynamicGrid.ActiveControl: TControl; |
496 |
+ |
var AParent: TWinControl; |
497 |
+ |
begin |
498 |
+ |
Result := nil; |
499 |
+ |
AParent := Parent; |
500 |
+ |
while (AParent <> nil) and not (AParent is TCustomForm) do |
501 |
+ |
AParent := AParent.Parent; |
502 |
+ |
if (AParent <> nil) and (AParent is TCustomForm)then |
503 |
+ |
Result := TCustomForm(AParent).ActiveControl; |
504 |
+ |
end; |
505 |
+ |
|
506 |
|
procedure TDBDynamicGrid.DoShowEditorPanel(Data: PtrInt); |
507 |
|
begin |
508 |
|
if AppDestroying in Application.Flags then Exit; |
534 |
|
procedure TDBDynamicGrid.KeyDownHandler(Sender: TObject; var Key: Word; |
535 |
|
Shift: TShiftState); |
536 |
|
var Done: boolean; |
537 |
+ |
AControl: TControl; |
538 |
|
begin |
539 |
|
if Visible and assigned(FEditorPanel) and FEditorPanel.Visible and FWeHaveFocus then |
540 |
|
begin |
541 |
|
Done := false; |
542 |
+ |
AControl := ActiveControl; |
543 |
+ |
if (AControl <> nil) and (AControl is TCustomComboBox) |
544 |
+ |
and ((Key in [VK_UP,VK_DOWN]) or |
545 |
+ |
(TCustomComboBox(AControl).DroppedDown and (Key = VK_RETURN)) or |
546 |
+ |
((TCustomComboBox(AControl).Text <> '') and (Key = VK_ESCAPE))) then |
547 |
+ |
Exit; {ignore these keys if we are in a combobox} |
548 |
+ |
|
549 |
+ |
if (AControl <> nil) and (AControl is TCustomMemo) |
550 |
+ |
and (Key = VK_RETURN) then Exit; {Ignore Return in a CustomMemo} |
551 |
|
if assigned(FOnKeyDownHander) then |
552 |
|
OnKeyDownHander(Sender,Key,Shift,Done); |
553 |
|
if Done then Exit; |
794 |
|
FCol := Msg.Col; |
795 |
|
FRow := Msg.Row; |
796 |
|
FEditText := Msg.Value; |
773 |
– |
SelStart := Length(Text); |
797 |
|
TIBDynamicGrid(FGrid).SetupEditor(self,FCol); |
798 |
|
end; |
799 |
|
|
842 |
|
Editor.OnAutoInsert := OnAutoInsert; |
843 |
|
Editor.OnCanAutoInsert := OnCanAutoInsert; |
844 |
|
Editor.OnDrawItem := OnDrawItem; |
845 |
+ |
Editor.OnCloseUp := OnCloseUp; |
846 |
|
|
847 |
|
{Setup Data Links} |
848 |
|
if KeyField <> '' then |
868 |
|
Editor.DataSource := TDBGrid(Grid).DataSource; |
869 |
|
end; |
870 |
|
Editor.Text := Editor.FEditText; |
871 |
+ |
Editor.SelStart := Length(Editor.Text); |
872 |
|
end; |
873 |
|
|
874 |
|
procedure TIBDynamicGridColumn.SetInitialSortColumn(AValue: boolean); |
1074 |
|
procedure TIBDynamicGrid.Loaded; |
1075 |
|
begin |
1076 |
|
inherited Loaded; |
1077 |
+ |
IBControlLinkChanged; |
1078 |
|
ProcessColumns; |
1079 |
|
end; |
1080 |
|
|