152 |
|
FLastMouseButton: TMouseButton; |
153 |
|
FLastMouseShiftState: TShiftState; |
154 |
|
|
155 |
+ |
function ActiveControl: TControl; |
156 |
|
procedure EmptyGrid; |
157 |
|
function GetDataSource: TDataSource; |
158 |
|
function GetRecordCount: Integer; |
523 |
|
|
524 |
|
{ TDBControlGrid } |
525 |
|
|
526 |
+ |
function TDBControlGrid.ActiveControl: TControl; |
527 |
+ |
var AParent: TWinControl; |
528 |
+ |
begin |
529 |
+ |
Result := nil; |
530 |
+ |
AParent := Parent; |
531 |
+ |
while (AParent <> nil) and not (AParent is TCustomForm) do |
532 |
+ |
AParent := AParent.Parent; |
533 |
+ |
if (AParent <> nil) and (AParent is TCustomForm)then |
534 |
+ |
Result := TCustomForm(AParent).ActiveControl; |
535 |
+ |
end; |
536 |
+ |
|
537 |
|
procedure TDBControlGrid.EmptyGrid; |
538 |
|
var |
539 |
|
OldFixedRows: Integer; |
656 |
|
procedure TDBControlGrid.KeyDownHandler(Sender: TObject; var Key: Word; |
657 |
|
Shift: TShiftState); |
658 |
|
var Done: boolean; |
659 |
+ |
AControl: TControl; |
660 |
|
begin |
661 |
|
if Visible and assigned(FDrawPanel) and FDrawPanel.Visible and FWeHaveFocus then |
662 |
|
begin |
663 |
+ |
AControl := ActiveControl; |
664 |
+ |
if (AControl <> nil) and (AControl is TCustomComboBox) |
665 |
+ |
and ((Key in [VK_UP,VK_DOWN]) or |
666 |
+ |
(TCustomComboBox(AControl).DroppedDown and (Key = VK_RETURN)) or |
667 |
+ |
((TCustomComboBox(AControl).Text <> '') and (Key = VK_ESCAPE))) then |
668 |
+ |
Exit; {ignore these keys if we are in a combobox} |
669 |
+ |
|
670 |
+ |
if (AControl <> nil) and (AControl is TCustomMemo) |
671 |
+ |
and (Key = VK_RETURN) then Exit; {Ignore Return in a CustomMemo} |
672 |
+ |
|
673 |
|
Done := false; |
674 |
|
if assigned(FOnKeyDownHander) then |
675 |
|
OnKeyDownHander(Sender,Key,Shift,Done); |