From da9cd70ff8fb940d329aaa32444c8e0c062946b5 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Sat, 20 Feb 2021 08:27:49 +0000 Subject: [PATCH] RxFPC:fix RxDBGrid dblclick if RxDBGrid palced on TFrame git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7973 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/trunk/rxdb/rxdbgrid.pas | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/components/rx/trunk/rxdb/rxdbgrid.pas b/components/rx/trunk/rxdb/rxdbgrid.pas index 16228650f..13328b3ae 100644 --- a/components/rx/trunk/rxdb/rxdbgrid.pas +++ b/components/rx/trunk/rxdb/rxdbgrid.pas @@ -888,6 +888,7 @@ type procedure OnDataSetScrolled(aDataSet:TDataSet; Distance: Integer); procedure FillFilterData; + procedure DoCblClickMrOk; protected FRxDbGridLookupComboEditor: TCustomControl; FRxDbGridDateEditor: TWinControl; @@ -4318,6 +4319,18 @@ begin end; +procedure TRxDBGrid.DoCblClickMrOk; +begin + if Owner is TCustomForm then + TCustomForm(Owner).ModalResult := mrOk + else + if Owner is TCustomFrame then + begin + if TCustomFrame(Owner).Owner is TCustomForm then + ((TCustomFrame(Owner).Owner) as TCustomForm).ModalResult := mrOk + end; +end; + procedure TRxDBGrid.DefaultDrawCellA(aCol, aRow: integer; aRect: TRect; aState: TGridDrawState); begin @@ -5338,15 +5351,16 @@ begin if TRxDBGridAbstractTools(FToolsList[i]).MouseDown(Button, Shift, X, Y) then exit; - if rdgMrOkOnDblClik in FOptionsRx then - begin + if (rdgMrOkOnDblClik in FOptionsRx) and (Cell.Y > 0) and (Cell.X >= Ord(dgIndicator in Options)) and (ssDouble in Shift) then + DoCblClickMrOk; +(* begin if (Cell.Y > 0) and (Cell.X >= Ord(dgIndicator in Options)) and (ssDouble in Shift) then begin if Owner is TCustomForm then TCustomForm(Owner).ModalResult := mrOk; end; - end; + end; *) inherited MouseDown(Button, Shift, X, Y); end; end;