You've already forked lazarus-ccr
RxFPC:enable find in RxDBGrid for all collumns
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7088 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -522,6 +522,10 @@ msgstr "Sensitivo MAY/min"
|
|||||||
msgid "Direction"
|
msgid "Direction"
|
||||||
msgstr "Dirección"
|
msgstr "Dirección"
|
||||||
|
|
||||||
|
#: rxdconst.srxdbgridfindinallfileds
|
||||||
|
msgid "Find in all fields"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxdconst.srxdbgridfindonfield
|
#: rxdconst.srxdbgridfindonfield
|
||||||
msgid "Find on field"
|
msgid "Find on field"
|
||||||
msgstr "Buscar en campo"
|
msgstr "Buscar en campo"
|
||||||
|
@ -514,6 +514,10 @@ msgstr "Rozróżniaj wielkość liter"
|
|||||||
msgid "Direction"
|
msgid "Direction"
|
||||||
msgstr "Kierunek"
|
msgstr "Kierunek"
|
||||||
|
|
||||||
|
#: rxdconst.srxdbgridfindinallfileds
|
||||||
|
msgid "Find in all fields"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxdconst.srxdbgridfindonfield
|
#: rxdconst.srxdbgridfindonfield
|
||||||
msgid "Find on field"
|
msgid "Find on field"
|
||||||
msgstr "Szukaj w polu"
|
msgstr "Szukaj w polu"
|
||||||
|
@ -503,6 +503,10 @@ msgstr ""
|
|||||||
msgid "Direction"
|
msgid "Direction"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxdconst.srxdbgridfindinallfileds
|
||||||
|
msgid "Find in all fields"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxdconst.srxdbgridfindonfield
|
#: rxdconst.srxdbgridfindonfield
|
||||||
msgid "Find on field"
|
msgid "Find on field"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -513,6 +513,10 @@ msgstr "Регистро-зависимо"
|
|||||||
msgid "Direction"
|
msgid "Direction"
|
||||||
msgstr "Направление"
|
msgstr "Направление"
|
||||||
|
|
||||||
|
#: rxdconst.srxdbgridfindinallfileds
|
||||||
|
msgid "Find in all fields"
|
||||||
|
msgstr "Поиск во всех полях"
|
||||||
|
|
||||||
#: rxdconst.srxdbgridfindonfield
|
#: rxdconst.srxdbgridfindonfield
|
||||||
msgid "Find on field"
|
msgid "Find on field"
|
||||||
msgstr "Искать по полю"
|
msgstr "Искать по полю"
|
||||||
|
@ -514,6 +514,10 @@ msgstr "Harfe duyarlı"
|
|||||||
msgid "Direction"
|
msgid "Direction"
|
||||||
msgstr "Yön"
|
msgstr "Yön"
|
||||||
|
|
||||||
|
#: rxdconst.srxdbgridfindinallfileds
|
||||||
|
msgid "Find in all fields"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxdconst.srxdbgridfindonfield
|
#: rxdconst.srxdbgridfindonfield
|
||||||
msgid "Find on field"
|
msgid "Find on field"
|
||||||
msgstr "Alanda bul"
|
msgstr "Alanda bul"
|
||||||
|
@ -518,6 +518,10 @@ msgstr "Регістрозалежно"
|
|||||||
msgid "Direction"
|
msgid "Direction"
|
||||||
msgstr "Напрямок"
|
msgstr "Напрямок"
|
||||||
|
|
||||||
|
#: rxdconst.srxdbgridfindinallfileds
|
||||||
|
msgid "Find in all fields"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxdconst.srxdbgridfindonfield
|
#: rxdconst.srxdbgridfindonfield
|
||||||
msgid "Find on field"
|
msgid "Find on field"
|
||||||
msgstr "Шукати по полю"
|
msgstr "Шукати по полю"
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
object rxDBGridFindForm: TrxDBGridFindForm
|
object rxDBGridFindForm: TrxDBGridFindForm
|
||||||
Left = 688
|
Left = 688
|
||||||
Height = 260
|
Height = 287
|
||||||
Top = 327
|
Top = 327
|
||||||
Width = 493
|
Width = 508
|
||||||
ActiveControl = Edit1
|
ActiveControl = Edit1
|
||||||
Caption = 'Find'
|
Caption = 'Find'
|
||||||
ClientHeight = 260
|
ClientHeight = 287
|
||||||
ClientWidth = 493
|
ClientWidth = 508
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
@ -17,36 +17,22 @@ object rxDBGridFindForm: TrxDBGridFindForm
|
|||||||
AnchorSideBottom.Control = Edit1
|
AnchorSideBottom.Control = Edit1
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 13
|
Height = 17
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 56
|
Width = 69
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Text to find'
|
Caption = 'Text to find'
|
||||||
FocusControl = Edit1
|
FocusControl = Edit1
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label2: TLabel
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideTop.Control = Edit1
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = ComboBox1
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 6
|
|
||||||
Height = 13
|
|
||||||
Top = 52
|
|
||||||
Width = 56
|
|
||||||
BorderSpacing.Around = 6
|
|
||||||
Caption = 'Find at filed'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object BtnFind: TButton
|
object BtnFind: TButton
|
||||||
AnchorSideRight.Control = Button2
|
AnchorSideRight.Control = Button2
|
||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 340
|
Left = 352
|
||||||
Height = 31
|
Height = 41
|
||||||
Top = 223
|
Top = 240
|
||||||
Width = 81
|
Width = 86
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
@ -63,13 +49,12 @@ object rxDBGridFindForm: TrxDBGridFindForm
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 427
|
Left = 444
|
||||||
Height = 31
|
Height = 41
|
||||||
Top = 223
|
Top = 240
|
||||||
Width = 60
|
Width = 58
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
BorderSpacing.InnerBorder = 4
|
BorderSpacing.InnerBorder = 4
|
||||||
Cancel = True
|
Cancel = True
|
||||||
@ -84,42 +69,42 @@ object rxDBGridFindForm: TrxDBGridFindForm
|
|||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 18
|
Left = 18
|
||||||
Height = 21
|
Height = 34
|
||||||
Top = 25
|
Top = 29
|
||||||
Width = 469
|
Width = 484
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object ComboBox1: TComboBox
|
object ComboBox1: TComboBox
|
||||||
AnchorSideLeft.Control = Label2
|
AnchorSideLeft.Control = RadioButton1
|
||||||
AnchorSideTop.Control = Label2
|
AnchorSideTop.Control = RadioButton1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 12
|
Left = 12
|
||||||
Height = 21
|
Height = 33
|
||||||
Top = 71
|
Top = 98
|
||||||
Width = 475
|
Width = 490
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object RadioGroup1: TRadioGroup
|
object RadioGroup1: TRadioGroup
|
||||||
AnchorSideLeft.Control = Panel1
|
AnchorSideLeft.Control = Panel1
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = ComboBox1
|
AnchorSideTop.Control = RadioButton2
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = Panel1
|
AnchorSideBottom.Control = Panel1
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 119
|
Left = 139
|
||||||
Height = 54
|
Height = 66
|
||||||
Top = 98
|
Top = 166
|
||||||
Width = 368
|
Width = 363
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
AutoFill = True
|
AutoFill = True
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
@ -135,8 +120,8 @@ object rxDBGridFindForm: TrxDBGridFindForm
|
|||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
ChildSizing.ControlsPerLine = 3
|
ChildSizing.ControlsPerLine = 3
|
||||||
ClientHeight = 36
|
ClientHeight = 48
|
||||||
ClientWidth = 364
|
ClientWidth = 361
|
||||||
Columns = 3
|
Columns = 3
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'All'
|
'All'
|
||||||
@ -147,25 +132,25 @@ object rxDBGridFindForm: TrxDBGridFindForm
|
|||||||
end
|
end
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = ComboBox1
|
AnchorSideTop.Control = RadioButton2
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 54
|
Height = 66
|
||||||
Top = 98
|
Top = 166
|
||||||
Width = 107
|
Width = 127
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
ClientHeight = 54
|
ClientHeight = 66
|
||||||
ClientWidth = 107
|
ClientWidth = 127
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
object CheckBox2: TCheckBox
|
object CheckBox2: TCheckBox
|
||||||
AnchorSideLeft.Control = Panel1
|
AnchorSideLeft.Control = Panel1
|
||||||
AnchorSideTop.Control = CheckBox1
|
AnchorSideTop.Control = CheckBox1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 7
|
Left = 7
|
||||||
Height = 17
|
Height = 23
|
||||||
Top = 30
|
Top = 36
|
||||||
Width = 70
|
Width = 88
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Partial key'
|
Caption = 'Partial key'
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@ -174,12 +159,39 @@ object rxDBGridFindForm: TrxDBGridFindForm
|
|||||||
AnchorSideLeft.Control = Panel1
|
AnchorSideLeft.Control = Panel1
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
Left = 7
|
Left = 7
|
||||||
Height = 17
|
Height = 23
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 93
|
Width = 113
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Case sensetive'
|
Caption = 'Case sensetive'
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object RadioButton1: TRadioButton
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = Edit1
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 6
|
||||||
|
Height = 23
|
||||||
|
Top = 69
|
||||||
|
Width = 98
|
||||||
|
Caption = 'Find at field'
|
||||||
|
Checked = True
|
||||||
|
OnClick = RadioButton1Click
|
||||||
|
TabOrder = 6
|
||||||
|
TabStop = True
|
||||||
|
end
|
||||||
|
object RadioButton2: TRadioButton
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = ComboBox1
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 6
|
||||||
|
Height = 23
|
||||||
|
Top = 137
|
||||||
|
Width = 121
|
||||||
|
BorderSpacing.Around = 6
|
||||||
|
Caption = 'Find in all fields'
|
||||||
|
OnClick = RadioButton1Click
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -51,13 +51,15 @@ type
|
|||||||
ComboBox1: TComboBox;
|
ComboBox1: TComboBox;
|
||||||
Edit1: TEdit;
|
Edit1: TEdit;
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
Label2: TLabel;
|
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
|
RadioButton1: TRadioButton;
|
||||||
|
RadioButton2: TRadioButton;
|
||||||
RadioGroup1: TRadioGroup;
|
RadioGroup1: TRadioGroup;
|
||||||
procedure BtnFindClick(Sender: TObject);
|
procedure BtnFindClick(Sender: TObject);
|
||||||
procedure Button2Click(Sender: TObject);
|
procedure Button2Click(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
|
procedure RadioButton1Click(Sender: TObject);
|
||||||
private
|
private
|
||||||
FGrid:TRxDBGrid;
|
FGrid:TRxDBGrid;
|
||||||
FDataSet:TDataSet;
|
FDataSet:TDataSet;
|
||||||
@ -69,7 +71,7 @@ type
|
|||||||
procedure ShowRxDBGridFindForm(Grid:TRxDBGrid);
|
procedure ShowRxDBGridFindForm(Grid:TRxDBGrid);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses rxdbutils, DBGrids, rxdconst;
|
uses rxdbutils, DBGrids, rxdconst, Variants;
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
@ -94,7 +96,8 @@ procedure TrxDBGridFindForm.FormCreate(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
Caption:=sRxDbGridFindCaption;
|
Caption:=sRxDbGridFindCaption;
|
||||||
Label1.Caption:=sRxDbGridFindText;
|
Label1.Caption:=sRxDbGridFindText;
|
||||||
Label2.Caption:=sRxDbGridFindOnField;
|
RadioButton1.Caption:=sRxDbGridFindOnField;
|
||||||
|
RadioButton2.Caption:=sRxDbGridFindInAllFileds;
|
||||||
CheckBox1.Caption:=sRxDbGridFindCaseSens;
|
CheckBox1.Caption:=sRxDbGridFindCaseSens;
|
||||||
CheckBox2.Caption:=sRxDbGridFindPartial;
|
CheckBox2.Caption:=sRxDbGridFindPartial;
|
||||||
RadioGroup1.Caption:=sRxDbGridFindDirecion;
|
RadioGroup1.Caption:=sRxDbGridFindDirecion;
|
||||||
@ -113,14 +116,21 @@ begin
|
|||||||
Edit1.SetFocus;
|
Edit1.SetFocus;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TrxDBGridFindForm.RadioButton1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ComboBox1.Enabled:=RadioButton1.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TrxDBGridFindForm.BtnFindClick(Sender: TObject);
|
procedure TrxDBGridFindForm.BtnFindClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
FieldName:string;
|
FieldName, S:string;
|
||||||
LOptions: TLocateOptions;
|
LOptions: TLocateOptions;
|
||||||
SearchOrigin:TRxSearchDirection;
|
SearchOrigin:TRxSearchDirection;
|
||||||
P:TBookMark;
|
P:TBookMark;
|
||||||
R:boolean;
|
R:boolean;
|
||||||
FC: TRxColumn;
|
FC: TRxColumn;
|
||||||
|
RF:TField;
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
{ TODO -oalexs : Необходимо переделать поиск по колонке - искать всегда по строковому представлению. Иначе не ищет по дате-времени }
|
{ TODO -oalexs : Необходимо переделать поиск по колонке - искать всегда по строковому представлению. Иначе не ищет по дате-времени }
|
||||||
if (Edit1.Text<>'') and (ComboBox1.ItemIndex>=0) and (ComboBox1.ItemIndex<ComboBox1.Items.Count) and (ComboBox1.Text<>'') then
|
if (Edit1.Text<>'') and (ComboBox1.ItemIndex>=0) and (ComboBox1.ItemIndex<ComboBox1.Items.Count) and (ComboBox1.Text<>'') then
|
||||||
@ -147,7 +157,20 @@ begin
|
|||||||
else
|
else
|
||||||
if SearchOrigin = rsdBackward then
|
if SearchOrigin = rsdBackward then
|
||||||
FDataSet.Prior;
|
FDataSet.Prior;
|
||||||
R:=DataSetLocateThrough(FDataSet, FieldName, Edit1.Text, LOptions, SearchOrigin);
|
if RadioButton1.Checked then
|
||||||
|
R:=DataSetLocateThrough(FDataSet, FieldName, Edit1.Text, LOptions, SearchOrigin)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
S:='';
|
||||||
|
for i:=0 to FDataSet.Fields.Count-1 do
|
||||||
|
begin
|
||||||
|
if S<>'' then S:=S + ';';
|
||||||
|
S:=S + FDataSet.Fields[i].FieldName;
|
||||||
|
end;
|
||||||
|
R:=DataSetLocateThroughEx(FDataSet, S, Edit1.Text, LOptions, SearchOrigin, false, RF);
|
||||||
|
if R then
|
||||||
|
FGrid.SelectedField:=RF;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
{$IFDEF NoAutomatedBookmark}
|
{$IFDEF NoAutomatedBookmark}
|
||||||
if not R then
|
if not R then
|
||||||
|
@ -111,6 +111,9 @@ procedure InternalRestoreFields(DataSet: TDataSet; IniFile: TObject;
|
|||||||
function DataSetLocateThrough(DataSet: TDataSet; const KeyFields: string;
|
function DataSetLocateThrough(DataSet: TDataSet; const KeyFields: string;
|
||||||
const KeyValues: Variant; Options: TLocateOptions; SearchOrigin:TRxSearchDirection = rsdAll; ASearchFromStart:boolean = false): Boolean;
|
const KeyValues: Variant; Options: TLocateOptions; SearchOrigin:TRxSearchDirection = rsdAll; ASearchFromStart:boolean = false): Boolean;
|
||||||
|
|
||||||
|
function DataSetLocateThroughEx(DataSet: TDataSet; const KeyFields: string;
|
||||||
|
const KeyValues: Variant; Options: TLocateOptions; SearchOrigin:TRxSearchDirection; ASearchFromStart:boolean; out ResultField:TField): Boolean;
|
||||||
|
|
||||||
procedure SaveFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile);
|
procedure SaveFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile);
|
||||||
procedure RestoreFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile;
|
procedure RestoreFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile;
|
||||||
RestoreVisible: Boolean);
|
RestoreVisible: Boolean);
|
||||||
@ -167,7 +170,7 @@ procedure _DBError(const Msg: string);
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses Forms, Controls, Dialogs, RXDConst, rxlclutils, FileUtil,
|
uses Forms, Controls, Dialogs, RXDConst, rxlclutils, FileUtil, Variants,
|
||||||
RxAppUtils, RxStrUtils, Math, rxdateutil, LazUTF8;
|
RxAppUtils, RxStrUtils, Math, rxdateutil, LazUTF8;
|
||||||
|
|
||||||
{ Utility routines }
|
{ Utility routines }
|
||||||
@ -389,16 +392,38 @@ end;
|
|||||||
function DataSetLocateThrough(DataSet: TDataSet; const KeyFields: string;
|
function DataSetLocateThrough(DataSet: TDataSet; const KeyFields: string;
|
||||||
const KeyValues: Variant; Options: TLocateOptions; SearchOrigin:TRxSearchDirection = rsdAll;
|
const KeyValues: Variant; Options: TLocateOptions; SearchOrigin:TRxSearchDirection = rsdAll;
|
||||||
ASearchFromStart:boolean = false): Boolean;
|
ASearchFromStart:boolean = false): Boolean;
|
||||||
|
var
|
||||||
|
R: TField;
|
||||||
|
begin
|
||||||
|
Result:=DataSetLocateThroughEx(DataSet, KeyFields, KeyValues, Options, SearchOrigin, ASearchFromStart, R)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure SaveFields(DataSet: TDataSet; IniFile: TIniFile);
|
||||||
|
begin
|
||||||
|
InternalSaveFields(DataSet, IniFile, DataSetSectionName(DataSet));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure RestoreFields(DataSet: TDataSet; IniFile: TIniFile;
|
||||||
|
RestoreVisible: Boolean);
|
||||||
|
begin
|
||||||
|
InternalRestoreFields(DataSet, IniFile, DataSetSectionName(DataSet),
|
||||||
|
RestoreVisible);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function DataSetLocateThroughEx(DataSet: TDataSet; const KeyFields: string;
|
||||||
|
const KeyValues: Variant; Options: TLocateOptions;
|
||||||
|
SearchOrigin: TRxSearchDirection; ASearchFromStart: boolean; out
|
||||||
|
ResultField: TField): Boolean;
|
||||||
var
|
var
|
||||||
FieldCount: Integer;
|
FieldCount: Integer;
|
||||||
Fields: TList;
|
Fields: TList;
|
||||||
|
SingleValueFind:boolean;
|
||||||
|
|
||||||
function CompareField(Field: TField; Value: Variant): Boolean;
|
function CompareField(Field: TField; Value: Variant): Boolean;
|
||||||
var
|
var
|
||||||
S,S1: string;
|
S,S1: string;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (Field.DataType = ftString) or (loPartialKey in Options) then
|
if (Field.DataType = ftString) or (loPartialKey in Options) or SingleValueFind then
|
||||||
begin
|
begin
|
||||||
if loCaseInsensitive in Options then
|
if loCaseInsensitive in Options then
|
||||||
begin
|
begin
|
||||||
@ -412,7 +437,7 @@ var
|
|||||||
end;
|
end;
|
||||||
{ if (loPartialKey in Options) then
|
{ if (loPartialKey in Options) then
|
||||||
Delete(S, Length(S1) + 1, MaxInt);
|
Delete(S, Length(S1) + 1, MaxInt);
|
||||||
|
|
||||||
if (loCaseInsensitive in Options) then
|
if (loCaseInsensitive in Options) then
|
||||||
Result := UTF8CompareText(S, S1) = 0
|
Result := UTF8CompareText(S, S1) = 0
|
||||||
else
|
else
|
||||||
@ -439,15 +464,43 @@ var
|
|||||||
function CompareRecord: Boolean;
|
function CompareRecord: Boolean;
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
|
V:Variant;
|
||||||
|
B: Boolean;
|
||||||
begin
|
begin
|
||||||
if FieldCount = 1 then
|
if FieldCount = 1 then
|
||||||
Result := CompareField(TField(Fields.First), KeyValues)
|
Result := CompareField(TField(Fields.First), KeyValues)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
|
if not VarIsArray(KeyValues) then
|
||||||
|
begin
|
||||||
|
SingleValueFind:=true;
|
||||||
|
V:=KeyValues;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if (Length(KeyValues)=1) then
|
||||||
|
begin
|
||||||
|
SingleValueFind:=true;
|
||||||
|
V:=KeyValues[0];
|
||||||
|
end;
|
||||||
|
|
||||||
|
if SingleValueFind then
|
||||||
|
begin
|
||||||
|
B:=false;
|
||||||
|
for I := 0 to FieldCount - 1 do
|
||||||
|
begin
|
||||||
|
B:=B or CompareField(TField(Fields[I]), V);
|
||||||
|
if B then
|
||||||
|
begin
|
||||||
|
ResultField:=TField(Fields[I]);
|
||||||
|
Exit(B);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Exit(B);
|
||||||
|
end
|
||||||
|
else
|
||||||
for I := 0 to FieldCount - 1 do
|
for I := 0 to FieldCount - 1 do
|
||||||
begin
|
begin
|
||||||
//Result := Result and CompareField(TField(Fields[I]), KeyValues[I]);
|
|
||||||
if not CompareField(TField(Fields[I]), KeyValues[I]) then
|
if not CompareField(TField(Fields[I]), KeyValues[I]) then
|
||||||
Exit(false);
|
Exit(false);
|
||||||
end;
|
end;
|
||||||
@ -458,6 +511,8 @@ var
|
|||||||
Bookmark: TBookmark;
|
Bookmark: TBookmark;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
ResultField:=nil;
|
||||||
|
SingleValueFind:=false;
|
||||||
with DataSet do
|
with DataSet do
|
||||||
begin
|
begin
|
||||||
CheckBrowseMode;
|
CheckBrowseMode;
|
||||||
@ -524,18 +579,6 @@ begin
|
|||||||
Fields.Free;
|
Fields.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure SaveFields(DataSet: TDataSet; IniFile: TIniFile);
|
|
||||||
begin
|
|
||||||
InternalSaveFields(DataSet, IniFile, DataSetSectionName(DataSet));
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure RestoreFields(DataSet: TDataSet; IniFile: TIniFile;
|
|
||||||
RestoreVisible: Boolean);
|
|
||||||
begin
|
|
||||||
InternalRestoreFields(DataSet, IniFile, DataSetSectionName(DataSet),
|
|
||||||
RestoreVisible);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure SaveFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile);
|
procedure SaveFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile);
|
||||||
begin
|
begin
|
||||||
InternalSaveFields(DataSet, IniFile, DataSetSectionName(DataSet));
|
InternalSaveFields(DataSet, IniFile, DataSetSectionName(DataSet));
|
||||||
|
@ -150,6 +150,7 @@ resourcestring
|
|||||||
sRxDbGridFindCaption = 'Find data';
|
sRxDbGridFindCaption = 'Find data';
|
||||||
sRxDbGridFindText = 'Text to find';
|
sRxDbGridFindText = 'Text to find';
|
||||||
sRxDbGridFindOnField = 'Find on field';
|
sRxDbGridFindOnField = 'Find on field';
|
||||||
|
sRxDbGridFindInAllFileds = 'Find in all fields';
|
||||||
sRxDbGridFindCaseSens = 'Case sensetive';
|
sRxDbGridFindCaseSens = 'Case sensetive';
|
||||||
sRxDbGridFindPartial = 'Partial key';
|
sRxDbGridFindPartial = 'Partial key';
|
||||||
sRxDbGridFindDirecion = 'Direction';
|
sRxDbGridFindDirecion = 'Direction';
|
||||||
|
Reference in New Issue
Block a user