RxFPC: rewrite find dialog in RxDBGrid for all record find - tnx. ssadragon

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7988 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2021-04-12 06:33:16 +00:00
parent 87e8e3b80f
commit 901540cc3c
2 changed files with 36 additions and 7 deletions

View File

@ -69,11 +69,12 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 18
Height = 34
Height = 33
Top = 29
Width = 484
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
OnChange = Edit1Change
TabOrder = 0
end
object ComboBox1: TComboBox
@ -83,8 +84,8 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 12
Height = 33
Top = 98
Height = 32
Top = 97
Width = 490
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
@ -103,7 +104,7 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideBottom.Side = asrBottom
Left = 139
Height = 66
Top = 166
Top = 164
Width = 363
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True
@ -128,6 +129,7 @@ object rxDBGridFindForm: TrxDBGridFindForm
'Forward'
'Backward'
)
OnSelectionChanged = RadioGroup1SelectionChanged
TabOrder = 4
end
object Panel1: TPanel
@ -136,7 +138,7 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 66
Top = 166
Top = 164
Width = 127
AutoSize = True
BorderSpacing.Around = 6
@ -173,7 +175,7 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 69
Top = 68
Width = 98
Caption = 'Find at field'
Checked = True
@ -187,7 +189,7 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 137
Top = 135
Width = 121
BorderSpacing.Around = 6
Caption = 'Find in all fields'

View File

@ -57,10 +57,13 @@ type
RadioGroup1: TRadioGroup;
procedure BtnFindClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioGroup1SelectionChanged(Sender: TObject);
private
FFirstSearch: Boolean;
FGrid:TRxDBGrid;
FDataSet:TDataSet;
procedure SetGrid(AGrid:TRxDBGrid);
@ -92,6 +95,12 @@ begin
Close;
end;
procedure TrxDBGridFindForm.Edit1Change(Sender: TObject);
begin
if RadioGroup1.ItemIndex = 0 then
FFirstSearch:=true;
end;
procedure TrxDBGridFindForm.FormCreate(Sender: TObject);
begin
Caption:=sRxDbGridFindCaption;
@ -121,6 +130,12 @@ begin
ComboBox1.Enabled:=RadioButton1.Checked;
end;
procedure TrxDBGridFindForm.RadioGroup1SelectionChanged(Sender: TObject);
begin
if RadioGroup1.ItemIndex = 0 then
FFirstSearch:=True;
end;
procedure TrxDBGridFindForm.BtnFindClick(Sender: TObject);
var
FieldName, S:string;
@ -152,6 +167,15 @@ begin
{$ELSE}
P:=FDataSet.Bookmark;
{$ENDIF}
if SearchOrigin = rsdAll Then
begin
if FFirstSearch then
FDataSet.First
else
FDataSet.Next;
SearchOrigin:=rsdForward;
end
else
if SearchOrigin = rsdForward then
FDataSet.Next
else
@ -180,6 +204,7 @@ begin
if not R then
FDataSet.Bookmark:=P;
{$ENDIF}
FFirstSearch := False;
end;
end;
end;
@ -200,6 +225,8 @@ begin
end;
ComboBox1.ItemIndex:=ComboBox1.Items.IndexOf(AGrid.SelectedColumn.Title.Caption);
CheckBox1.Checked := not (loCaseInsensitive in AGrid.SearchOptions.QuickSearchOptions);
CheckBox2.Checked := loPartialKey in AGrid.SearchOptions.QuickSearchOptions;
end;
FDataSet:=nil;