ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/ibcontrols/DBControlGrid.pas
(Generate patch)

Comparing ibx/trunk/ibcontrols/DBControlGrid.pas (file contents):
Revision 29 by tony, Sat May 9 11:37:49 2015 UTC vs.
Revision 31 by tony, Tue Jul 14 15:31:25 2015 UTC

# Line 152 | Line 152 | type
152      FLastMouseButton: TMouseButton;
153      FLastMouseShiftState: TShiftState;
154  
155 +    function ActiveControl: TControl;
156      procedure EmptyGrid;
157      function GetDataSource: TDataSource;
158      function GetRecordCount: Integer;
# Line 522 | Line 523 | end;
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;
# Line 644 | Line 656 | end;
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines