From 7e669298677430ced8cda4f3bdaec9dd09394ee9 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Fri, 17 May 2019 06:56:30 +0000 Subject: [PATCH] RxFPC:fix find dialog in RxDBGrid with collumn.options=coDisableDialogFind git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6917 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../rx/trunk/rxdb/rxdbgrid_findunit.lfm | 52 +++++++++---------- .../rx/trunk/rxdb/rxdbgrid_findunit.pas | 14 ++--- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/components/rx/trunk/rxdb/rxdbgrid_findunit.lfm b/components/rx/trunk/rxdb/rxdbgrid_findunit.lfm index 23f3adec4..d35471a8d 100644 --- a/components/rx/trunk/rxdb/rxdbgrid_findunit.lfm +++ b/components/rx/trunk/rxdb/rxdbgrid_findunit.lfm @@ -17,9 +17,9 @@ object rxDBGridFindForm: TrxDBGridFindForm AnchorSideBottom.Control = Edit1 AnchorSideBottom.Side = asrBottom Left = 6 - Height = 19 + Height = 17 Top = 6 - Width = 73 + Width = 69 BorderSpacing.Around = 6 Caption = 'Text to find' FocusControl = Edit1 @@ -32,9 +32,9 @@ object rxDBGridFindForm: TrxDBGridFindForm AnchorSideBottom.Control = ComboBox1 AnchorSideBottom.Side = asrBottom Left = 6 - Height = 19 - Top = 68 - Width = 77 + Height = 17 + Top = 69 + Width = 72 BorderSpacing.Around = 6 Caption = 'Find at filed' ParentColor = False @@ -44,9 +44,9 @@ object rxDBGridFindForm: TrxDBGridFindForm AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 337 - Height = 39 - Top = 215 - Width = 87 + Height = 41 + Top = 213 + Width = 86 Anchors = [akRight, akBottom] AutoSize = True BorderSpacing.Around = 6 @@ -63,10 +63,10 @@ object rxDBGridFindForm: TrxDBGridFindForm AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom - Left = 430 - Height = 39 - Top = 215 - Width = 57 + Left = 429 + Height = 41 + Top = 213 + Width = 58 Anchors = [akRight, akBottom] AutoSize = True BorderSpacing.Top = 8 @@ -84,8 +84,8 @@ object rxDBGridFindForm: TrxDBGridFindForm AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 18 - Height = 31 - Top = 31 + Height = 34 + Top = 29 Width = 469 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 @@ -98,8 +98,8 @@ object rxDBGridFindForm: TrxDBGridFindForm AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 12 - Height = 31 - Top = 93 + Height = 33 + Top = 92 Width = 475 Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 6 @@ -116,10 +116,10 @@ object rxDBGridFindForm: TrxDBGridFindForm AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Panel1 AnchorSideBottom.Side = asrBottom - Left = 150 + Left = 139 Height = 66 - Top = 130 - Width = 337 + Top = 131 + Width = 348 Anchors = [akTop, akLeft, akRight, akBottom] AutoFill = True AutoSize = True @@ -135,8 +135,8 @@ object rxDBGridFindForm: TrxDBGridFindForm ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 3 - ClientHeight = 46 - ClientWidth = 335 + ClientHeight = 48 + ClientWidth = 346 Columns = 3 Items.Strings = ( 'All' @@ -151,12 +151,12 @@ object rxDBGridFindForm: TrxDBGridFindForm AnchorSideTop.Side = asrBottom Left = 6 Height = 66 - Top = 130 - Width = 138 + Top = 131 + Width = 127 AutoSize = True BorderSpacing.Around = 6 ClientHeight = 66 - ClientWidth = 138 + ClientWidth = 127 TabOrder = 5 object CheckBox2: TCheckBox AnchorSideLeft.Control = Panel1 @@ -165,7 +165,7 @@ object rxDBGridFindForm: TrxDBGridFindForm Left = 7 Height = 23 Top = 36 - Width = 95 + Width = 88 BorderSpacing.Around = 6 Caption = 'Partial key' TabOrder = 0 @@ -176,7 +176,7 @@ object rxDBGridFindForm: TrxDBGridFindForm Left = 7 Height = 23 Top = 7 - Width = 124 + Width = 113 BorderSpacing.Around = 6 Caption = 'Case sensetive' TabOrder = 1 diff --git a/components/rx/trunk/rxdb/rxdbgrid_findunit.pas b/components/rx/trunk/rxdb/rxdbgrid_findunit.pas index 699be4af0..2c921409b 100644 --- a/components/rx/trunk/rxdb/rxdbgrid_findunit.pas +++ b/components/rx/trunk/rxdb/rxdbgrid_findunit.pas @@ -122,11 +122,13 @@ var R:boolean; begin { TODO -oalexs : Необходимо переделать поиск по колонке - искать всегда по строковому представлению. Иначе не ищет по дате-времени } - if Edit1.Text<>'' then + if (Edit1.Text<>'') and (ComboBox1.ItemIndex>=0) and (ComboBox1.ItemIndex'') then begin try - FieldName:=FGrid.Columns[ComboBox1.ItemIndex].FieldName; + //FieldName:=FGrid.Columns[ComboBox1.ItemIndex].FieldName; + //FieldName:=FGrid.ColumnByFieldName(ComboBox1.Text).FieldName; + FieldName:=ComboBox1.Text; LOptions:=[]; if not CheckBox1.Checked then LOptions:=LOptions+[loCaseInsensitive]; @@ -158,11 +160,7 @@ begin end; end; end; -{ -type - THckGrid = class(TCustomDBGrid) - end; -} + procedure TrxDBGridFindForm.SetGrid(AGrid: TRxDBGrid); var i:integer; @@ -184,8 +182,6 @@ begin FDataSet:=nil; if Assigned(FGrid) and Assigned(FGrid.DataSource) then FDataSet:=FGrid.DataSource.DataSet; -{ if Assigned(FGrid) and Assigned(THckGrid(FGrid).DataSource) then - FDataSet:=THckGrid(FGrid).DataSource.DataSet;} BtnFind.Enabled:=Assigned(FDataSet) and FDataSet.Active end;