41 |
|
- automatic resizing of selected columns to fill the available row length |
42 |
|
- automatic positioning and sizing of a "totals" control, typically at the |
43 |
|
column footer, on a per column basis. |
44 |
< |
- DataSet resorting on header row click, sorting the dataset by the selected column. |
44 |
> |
- DataSet re-sorting on header row click, sorting the dataset by the selected column. |
45 |
|
A second click on the same header cell reversed the sort order. |
46 |
|
- Reselection of the same row following resorting. |
47 |
|
- A new cell editor that provides the same functionality as TIBLookupComboEditBox. |
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; |
182 |
– |
FHidingEditorPanel: boolean; |
183 |
– |
FAllowHide: boolean; |
185 |
|
FMouseDown: boolean; |
186 |
|
function ActiveControl: TControl; |
187 |
|
procedure DoShowEditorPanel(Data: PtrInt); |
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} |
309 |
|
|
310 |
|
implementation |
311 |
|
|
312 |
< |
uses Math, IBQuery, LCLType, Variants; |
312 |
> |
uses LCLType, Variants, EditBtn; |
313 |
|
|
314 |
|
{ TIBGridControlLink } |
315 |
|
|
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); |
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 |
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 |
|
|
998 |
|
destructor TIBDynamicGridColumn.Destroy; |
999 |
|
begin |
1000 |
|
if assigned(FDBLookupProperties) then FDBLookupProperties.Free; |
1001 |
+ |
Application.RemoveAsyncCalls(self); |
1002 |
|
inherited Destroy; |
1003 |
|
end; |
1004 |
|
|
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 |
|
|