33 |
|
uses |
34 |
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, DBGrids, DB, |
35 |
|
IBSQLParser, Grids, IBLookupComboEditBox, LMessages, StdCtrls, ExtCtrls, |
36 |
< |
IBCustomDataSet; |
36 |
> |
IBCustomDataSet, LCLVersion; |
37 |
|
|
38 |
|
type |
39 |
|
{ |
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. |
182 |
|
FOnSelectPanelEditor: TOnSelectPanelEditor; |
183 |
|
FResizing: boolean; |
184 |
|
FWeHaveFocus: boolean; |
185 |
– |
FHidingEditorPanel: boolean; |
186 |
– |
FAllowHide: boolean; |
185 |
|
FMouseDown: boolean; |
186 |
|
function ActiveControl: TControl; |
187 |
|
procedure DoShowEditorPanel(Data: PtrInt); |
196 |
|
procedure DoGridResize; |
197 |
|
procedure DoEditorHide; override; |
198 |
|
procedure DoEditorShow; override; |
199 |
+ |
{$IF (LCL_FULLVERSION < 2030000)} |
200 |
|
procedure DrawCellText(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState; aText: String); override; |
201 |
+ |
{$ELSE} |
202 |
+ |
procedure DrawCellText(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState; const aText: String); override; |
203 |
+ |
{$IFEND} |
204 |
|
Function EditingAllowed(ACol : Integer = -1) : Boolean; override; |
205 |
|
procedure EditorHide; override; |
206 |
|
procedure IndicatorClicked(Button: TMouseButton; Shift:TShiftState); virtual; |
313 |
|
|
314 |
|
implementation |
315 |
|
|
316 |
< |
uses Math, IBQuery, LCLType, Variants; |
316 |
> |
uses LCLType, Variants, EditBtn; |
317 |
|
|
318 |
|
{ TIBGridControlLink } |
319 |
|
|
456 |
|
inherited DoEditorShow; |
457 |
|
end; |
458 |
|
|
459 |
+ |
{$IF LCL_FULLVERSION < 2030000} |
460 |
|
procedure TDBDynamicGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect; |
461 |
|
aState: TGridDrawState; aText: String); |
462 |
+ |
{$ELSE} |
463 |
+ |
procedure TDBDynamicGrid.DrawCellText(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState; const aText: String); |
464 |
+ |
{$IFEND} |
465 |
|
var Style: TTextStyle; |
466 |
|
OldStyle: TTextStyle; |
467 |
|
begin |
574 |
|
Exit; {ignore these keys if we are in a combobox} |
575 |
|
|
576 |
|
if (AControl <> nil) and (AControl is TCustomMemo) |
577 |
< |
and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore Return in a CustomMemo} |
577 |
> |
and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore keys in a CustomMemo} |
578 |
|
|
579 |
|
if (AControl <> nil) and (AControl is TCustomGrid) |
580 |
< |
and (Key in [VK_RETURN,VK_UP,VK_DOWN,VK_TAB]) then Exit; {Ignore Return in a CustomMemo} |
580 |
> |
and (Key in [VK_RETURN,VK_UP,VK_DOWN,VK_TAB]) then Exit; {Ignore keys in a Custom Grid} |
581 |
> |
|
582 |
> |
if (AControl <> nil) and (AControl is TEBEdit) and (AControl.Owner is TDateEdit) then |
583 |
> |
begin |
584 |
> |
if (Key in [VK_LEFT,VK_RIGHT]) then Exit; {Ignore navigation keys} |
585 |
> |
if TDateEdit(AControl.Owner).DroppedDown and |
586 |
> |
(Key in [VK_RETURN,VK_UP,VK_DOWN,VK_ESCAPE]) then Exit; {Ignore TCalender navigation keys in a Data edit} |
587 |
> |
end; |
588 |
|
|
589 |
|
if assigned(FOnKeyDownHander) then |
590 |
|
OnKeyDownHander(Sender,Key,Shift,Done); |
1006 |
|
destructor TIBDynamicGridColumn.Destroy; |
1007 |
|
begin |
1008 |
|
if assigned(FDBLookupProperties) then FDBLookupProperties.Free; |
1009 |
+ |
Application.RemoveAsyncCalls(self); |
1010 |
|
inherited Destroy; |
1011 |
|
end; |
1012 |
|
|
1299 |
|
if assigned(FIBControlLink) then FIBControlLink.Free; |
1300 |
|
if assigned(FIndexFieldsList) then FIndexFieldsList.Free; |
1301 |
|
if assigned(FDBLookupCellEditor) then FDBLookupCellEditor.Free; |
1302 |
+ |
Application.RemoveAsyncCalls(self); |
1303 |
|
inherited Destroy; |
1304 |
|
end; |
1305 |
|
|