You've already forked lazarus-ccr
in rxdbgrid in filter and sort form show ColumnCaption for user choise
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2513 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -54,16 +54,16 @@
|
||||
<MinVersion Major="1" Release="18" Build="56" Valid="True"/>
|
||||
</Item4>
|
||||
</RequiredPackages>
|
||||
<Units Count="69">
|
||||
<Units Count="74">
|
||||
<Unit0>
|
||||
<Filename Value="RxDBGridDemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="RxDBGridDemo"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="9" Y="16"/>
|
||||
<UsageCount Value="56"/>
|
||||
<UsageCount Value="60"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -77,7 +77,7 @@
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="196"/>
|
||||
<CursorPos X="21" Y="201"/>
|
||||
<UsageCount Value="56"/>
|
||||
<UsageCount Value="60"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
@ -501,9 +501,9 @@
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1846"/>
|
||||
<CursorPos X="1" Y="1847"/>
|
||||
<UsageCount Value="11"/>
|
||||
<TopLine Value="3384"/>
|
||||
<CursorPos X="35" Y="3405"/>
|
||||
<UsageCount Value="13"/>
|
||||
<Bookmarks Count="3">
|
||||
<Item0 X="3" Y="73" ID="1"/>
|
||||
<Item1 X="13" Y="328" ID="2"/>
|
||||
@ -553,11 +553,11 @@
|
||||
<Unit64>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/vclutils.pas"/>
|
||||
<UnitName Value="vclutils"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="187"/>
|
||||
<CursorPos X="11" Y="220"/>
|
||||
<UsageCount Value="10"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="1" Y="35"/>
|
||||
<UsageCount Value="12"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit64>
|
||||
<Unit65>
|
||||
@ -570,12 +570,10 @@
|
||||
<Unit66>
|
||||
<Filename Value="/usr/local/share/lazarus/lcl/graphics.pp"/>
|
||||
<UnitName Value="Graphics"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="93"/>
|
||||
<CursorPos X="3" Y="99"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit66>
|
||||
<Unit67>
|
||||
<Filename Value="/usr/local/share/lazarus/lcl/include/lclintf.inc"/>
|
||||
@ -591,64 +589,180 @@
|
||||
<CursorPos X="1" Y="190"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit68>
|
||||
<Unit69>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<ComponentName Value="rxSortByForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="rxsortby"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="50"/>
|
||||
<CursorPos X="14" Y="65"/>
|
||||
<UsageCount Value="12"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit69>
|
||||
<Unit70>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<ComponentName Value="rxFilterByForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="rxfilterby"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="315"/>
|
||||
<CursorPos X="1" Y="350"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit70>
|
||||
<Unit71>
|
||||
<Filename Value="../../../../../../install/source/fpcsrc/rtl/objpas/classes/classesh.inc"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="645"/>
|
||||
<CursorPos X="15" Y="666"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit71>
|
||||
<Unit72>
|
||||
<Filename Value="../../../../../../install/source/fpcsrc/rtl/objpas/classes/stringl.inc"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="593"/>
|
||||
<CursorPos X="3" Y="598"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit72>
|
||||
<Unit73>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxstrutils.pas"/>
|
||||
<UnitName Value="rxstrutils"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="140"/>
|
||||
<CursorPos X="23" Y="168"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit73>
|
||||
</Units>
|
||||
<JumpHistory Count="14" HistoryIndex="13">
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="/usr/local/share/lazarus/lcl/graphics.pp"/>
|
||||
<Caret Line="1179" Column="14" TopLine="1128"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="72" Column="7" TopLine="53"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/vclutils.pas"/>
|
||||
<Caret Line="227" Column="1" TopLine="203"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="87" Column="14" TopLine="52"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/vclutils.pas"/>
|
||||
<Caret Line="228" Column="1" TopLine="203"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="245" Column="64" TopLine="222"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/vclutils.pas"/>
|
||||
<Caret Line="316" Column="1" TopLine="295"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="3476" Column="64" TopLine="3441"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="1867" Column="19" TopLine="1842"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="96" Column="25" TopLine="67"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="/usr/local/share/lazarus/lcl/graphics.pp"/>
|
||||
<Caret Line="1179" Column="14" TopLine="1158"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="69" Column="7" TopLine="41"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="1869" Column="33" TopLine="1842"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="118" Column="45" TopLine="94"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="1867" Column="19" TopLine="1846"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="256" Column="3" TopLine="235"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="/usr/local/share/lazarus/lcl/graphics.pp"/>
|
||||
<Caret Line="1179" Column="14" TopLine="1158"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="260" Column="1" TopLine="238"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="1867" Column="19" TopLine="1846"/>
|
||||
<Caret Line="3476" Column="29" TopLine="3455"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="1870" Column="19" TopLine="1846"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="223" Column="1" TopLine="181"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="/usr/local/share/lazarus/lcl/graphics.pp"/>
|
||||
<Caret Line="1179" Column="14" TopLine="1158"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxsortby.pas"/>
|
||||
<Caret Line="70" Column="21" TopLine="50"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="1870" Column="15" TopLine="1846"/>
|
||||
<Caret Line="3477" Column="34" TopLine="3455"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/vclutils.pas"/>
|
||||
<Caret Line="298" Column="3" TopLine="280"/>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="1483" Column="3" TopLine="1465"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="3400" Column="3" TopLine="3394"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="240" Column="2" TopLine="223"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="277" Column="1" TopLine="264"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="104" Column="41" TopLine="84"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="105" Column="5" TopLine="88"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="182" Column="37" TopLine="181"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="129" Column="17" TopLine="107"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="182" Column="36" TopLine="161"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="109" Column="15" TopLine="103"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="199" Column="5" TopLine="168"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="234" Column="12" TopLine="213"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="222" Column="30" TopLine="192"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="291" Column="12" TopLine="271"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="293" Column="1" TopLine="277"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxfilterby.pas"/>
|
||||
<Caret Line="136" Column="16" TopLine="107"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="/usr/local/share/lazarus/components/rxnew/rxdbgrid.pas"/>
|
||||
<Caret Line="3400" Column="3" TopLine="3394"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
@ -421,8 +421,7 @@ type
|
||||
FSortingNow:Boolean;
|
||||
FInProcessCalc: integer;
|
||||
FAllowedOperations: TRxDBGridAllowedOperations;
|
||||
//FFooterColor: TColor;
|
||||
//FFooterRowCount: integer;
|
||||
//
|
||||
FKeyStrokes: TRxDBGridKeyStrokes;
|
||||
FOnGetCellProps: TGetCellPropsEvent;
|
||||
FOptionsRx: TOptionsRx;
|
||||
@ -436,6 +435,7 @@ type
|
||||
FSortOrder: TSortMarker;
|
||||
FSortEngine: TRxDBGridSortEngine;
|
||||
FPressedCol: TColumn;
|
||||
//
|
||||
FPressed: boolean;
|
||||
FSwapButtons: boolean;
|
||||
FTracking: boolean;
|
||||
@ -2594,6 +2594,10 @@ begin
|
||||
FSortEngine.Sort(FSortField, DataSource.DataSet, FSortOrder =
|
||||
smUp, SortEngineOptions);
|
||||
FSortingNow:=false;
|
||||
|
||||
F_SortListField.Clear;
|
||||
if Assigned(FSortField) then
|
||||
F_SortListField.Add(FSortField.FieldName);
|
||||
end
|
||||
else
|
||||
HeaderClick(True, ACol);
|
||||
@ -3398,7 +3402,7 @@ begin
|
||||
OptionsRx := OptionsRx - [rdgFilter];
|
||||
rxFilterByForm := TrxFilterByForm.Create(Application);
|
||||
NewFilter := DataSource.DataSet.Filter;
|
||||
if rxFilterByForm.Execute(DataSource.DataSet, NewFilter, F_LastFilter) then
|
||||
if rxFilterByForm.Execute(Self, NewFilter, F_LastFilter) then
|
||||
begin
|
||||
if NewFilter <> '' then
|
||||
begin
|
||||
@ -3473,7 +3477,7 @@ begin
|
||||
rxSortByForm := TrxSortByForm.Create(Application);
|
||||
rxSortByForm.CheckBox1.Checked := rdgCaseInsensitiveSort in FOptionsRx;
|
||||
o := not (FSortOrder = smDown);
|
||||
if rxSortByForm.Execute(DataSource.DataSet, F_SortListField, o) then
|
||||
if rxSortByForm.Execute(Self, F_SortListField, o) then
|
||||
begin
|
||||
for i := 0 to F_SortListField.Count - 1 do
|
||||
begin
|
||||
|
@ -9,14 +9,14 @@ object rxFilterByForm: TrxFilterByForm
|
||||
ClientWidth = 644
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.31'
|
||||
LCLVersion = '1.1'
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 6
|
||||
Height = 18
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 235
|
||||
Width = 234
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Select filter expression for data'
|
||||
Font.Style = [fsBold]
|
||||
@ -28,9 +28,9 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 18
|
||||
Top = 30
|
||||
Width = 63
|
||||
Height = 15
|
||||
Top = 27
|
||||
Width = 62
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'On field:'
|
||||
Font.Color = clRed
|
||||
@ -42,9 +42,9 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 18
|
||||
Top = 30
|
||||
Width = 84
|
||||
Height = 15
|
||||
Top = 27
|
||||
Width = 83
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Operation :'
|
||||
Font.Color = clRed
|
||||
@ -56,9 +56,9 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 271
|
||||
Height = 18
|
||||
Top = 30
|
||||
Width = 89
|
||||
Height = 15
|
||||
Top = 27
|
||||
Width = 88
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Conditions :'
|
||||
Font.Color = clRed
|
||||
@ -71,9 +71,9 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 533
|
||||
Height = 18
|
||||
Top = 30
|
||||
Width = 75
|
||||
Height = 15
|
||||
Top = 27
|
||||
Width = 74
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Operand :'
|
||||
Font.Color = clRed
|
||||
@ -87,9 +87,9 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideBottom.Control = ComboBox25
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 527
|
||||
Height = 18
|
||||
Top = 343
|
||||
Width = 34
|
||||
Height = 15
|
||||
Top = 358
|
||||
Width = 33
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'End.'
|
||||
Font.Color = clRed
|
||||
@ -102,8 +102,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Control = Label2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 54
|
||||
Height = 29
|
||||
Top = 48
|
||||
Width = 153
|
||||
BorderSpacing.Around = 6
|
||||
ItemHeight = 0
|
||||
@ -114,8 +114,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Control = Label2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 27
|
||||
Top = 54
|
||||
Height = 29
|
||||
Top = 48
|
||||
Width = 96
|
||||
BorderSpacing.Around = 6
|
||||
DropDownCount = 9
|
||||
@ -129,8 +129,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComboBox3
|
||||
Left = 271
|
||||
Height = 23
|
||||
Top = 54
|
||||
Height = 25
|
||||
Top = 48
|
||||
Width = 250
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -143,8 +143,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 527
|
||||
Height = 27
|
||||
Top = 54
|
||||
Height = 29
|
||||
Top = 48
|
||||
Width = 111
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -163,8 +163,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 27
|
||||
Top = 89
|
||||
Height = 29
|
||||
Top = 85
|
||||
Width = 149
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -181,8 +181,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 27
|
||||
Top = 87
|
||||
Height = 29
|
||||
Top = 83
|
||||
Width = 96
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -199,8 +199,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComboBox3
|
||||
Left = 270
|
||||
Height = 23
|
||||
Top = 87
|
||||
Height = 25
|
||||
Top = 83
|
||||
Width = 251
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -214,8 +214,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 527
|
||||
Height = 27
|
||||
Top = 87
|
||||
Height = 29
|
||||
Top = 83
|
||||
Width = 111
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -234,8 +234,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 27
|
||||
Top = 124
|
||||
Height = 29
|
||||
Top = 122
|
||||
Width = 149
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -252,8 +252,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 27
|
||||
Top = 122
|
||||
Height = 29
|
||||
Top = 120
|
||||
Width = 96
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -270,8 +270,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComboBox3
|
||||
Left = 270
|
||||
Height = 23
|
||||
Top = 122
|
||||
Height = 25
|
||||
Top = 120
|
||||
Width = 251
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -285,8 +285,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 527
|
||||
Height = 27
|
||||
Top = 122
|
||||
Height = 29
|
||||
Top = 120
|
||||
Width = 111
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -305,7 +305,7 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 27
|
||||
Height = 29
|
||||
Top = 159
|
||||
Width = 149
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
@ -323,7 +323,7 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 27
|
||||
Height = 29
|
||||
Top = 157
|
||||
Width = 96
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
@ -341,7 +341,7 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComboBox3
|
||||
Left = 270
|
||||
Height = 23
|
||||
Height = 25
|
||||
Top = 157
|
||||
Width = 251
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
@ -356,7 +356,7 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 527
|
||||
Height = 27
|
||||
Height = 29
|
||||
Top = 157
|
||||
Width = 111
|
||||
Anchors = [akTop, akRight]
|
||||
@ -376,8 +376,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 27
|
||||
Top = 194
|
||||
Height = 29
|
||||
Top = 196
|
||||
Width = 149
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -394,8 +394,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 27
|
||||
Top = 192
|
||||
Height = 29
|
||||
Top = 194
|
||||
Width = 96
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -412,8 +412,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComboBox3
|
||||
Left = 270
|
||||
Height = 23
|
||||
Top = 192
|
||||
Height = 25
|
||||
Top = 194
|
||||
Width = 251
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -427,8 +427,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 527
|
||||
Height = 27
|
||||
Top = 192
|
||||
Height = 29
|
||||
Top = 194
|
||||
Width = 111
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -447,8 +447,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 27
|
||||
Top = 229
|
||||
Height = 29
|
||||
Top = 233
|
||||
Width = 149
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -465,8 +465,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 27
|
||||
Top = 227
|
||||
Height = 29
|
||||
Top = 231
|
||||
Width = 96
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -483,8 +483,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComboBox3
|
||||
Left = 270
|
||||
Height = 23
|
||||
Top = 227
|
||||
Height = 25
|
||||
Top = 231
|
||||
Width = 251
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -498,8 +498,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 527
|
||||
Height = 27
|
||||
Top = 227
|
||||
Height = 29
|
||||
Top = 231
|
||||
Width = 111
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -518,8 +518,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 27
|
||||
Top = 264
|
||||
Height = 29
|
||||
Top = 270
|
||||
Width = 149
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -536,8 +536,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 27
|
||||
Top = 262
|
||||
Height = 29
|
||||
Top = 268
|
||||
Width = 96
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -554,8 +554,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComboBox3
|
||||
Left = 270
|
||||
Height = 23
|
||||
Top = 262
|
||||
Height = 25
|
||||
Top = 268
|
||||
Width = 251
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -569,8 +569,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 527
|
||||
Height = 27
|
||||
Top = 262
|
||||
Height = 29
|
||||
Top = 268
|
||||
Width = 111
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -589,8 +589,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 27
|
||||
Top = 299
|
||||
Height = 29
|
||||
Top = 307
|
||||
Width = 149
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -607,8 +607,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 27
|
||||
Top = 297
|
||||
Height = 29
|
||||
Top = 305
|
||||
Width = 96
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -625,8 +625,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComboBox3
|
||||
Left = 270
|
||||
Height = 23
|
||||
Top = 297
|
||||
Height = 25
|
||||
Top = 305
|
||||
Width = 251
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -640,8 +640,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 527
|
||||
Height = 27
|
||||
Top = 297
|
||||
Height = 29
|
||||
Top = 305
|
||||
Width = 111
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
@ -660,8 +660,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 27
|
||||
Top = 334
|
||||
Height = 29
|
||||
Top = 344
|
||||
Width = 149
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -678,8 +678,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = ComboBox2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 27
|
||||
Top = 332
|
||||
Height = 29
|
||||
Top = 342
|
||||
Width = 96
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -696,8 +696,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComboBox3
|
||||
Left = 270
|
||||
Height = 23
|
||||
Top = 332
|
||||
Height = 25
|
||||
Top = 342
|
||||
Width = 251
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
@ -710,8 +710,8 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 412
|
||||
Height = 29
|
||||
Top = 410
|
||||
Width = 58
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
@ -729,10 +729,10 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 597
|
||||
Height = 23
|
||||
Top = 416
|
||||
Width = 41
|
||||
Left = 592
|
||||
Height = 27
|
||||
Top = 412
|
||||
Width = 46
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -745,10 +745,10 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Button1
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 542
|
||||
Height = 23
|
||||
Top = 416
|
||||
Width = 49
|
||||
Left = 533
|
||||
Height = 27
|
||||
Top = 412
|
||||
Width = 53
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -761,10 +761,10 @@ object rxFilterByForm: TrxFilterByForm
|
||||
AnchorSideRight.Control = Button2
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 465
|
||||
Height = 23
|
||||
Top = 416
|
||||
Width = 71
|
||||
Left = 452
|
||||
Height = 27
|
||||
Top = 412
|
||||
Width = 75
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
|
@ -36,8 +36,8 @@ unit rxfilterby;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, db;
|
||||
Classes, SysUtils, FileUtil, rxdbgrid, LResources, Forms, Controls, Graphics,
|
||||
Dialogs, StdCtrls, db;
|
||||
|
||||
type
|
||||
|
||||
@ -100,19 +100,20 @@ type
|
||||
Combo_2 : Array[1..9] of TComboBox;
|
||||
Edit_1 : Array[1..9] of TEdit;
|
||||
Combo_3 : Array[1..9] of TComboBox;
|
||||
Table : TDataSet;
|
||||
procedure ClearALL(adoTable : TDataSet);
|
||||
|
||||
FGrid : TRxDBGrid;
|
||||
procedure ClearALL(AGrid : TRxDBGrid);
|
||||
function FindCombo(CB:TComboBox):Integer;
|
||||
function FindEdit(ED:TEdit):Integer;
|
||||
public
|
||||
function Execute(adoTable : TDataSet; Var FilterStr : String; Var LastFilter : TstringList):Boolean;
|
||||
function Execute(AGrid : TRxDBGrid; var FilterStr : String; var LastFilter : TstringList):Boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
rxFilterByForm: TrxFilterByForm;
|
||||
|
||||
implementation
|
||||
uses rxdconst;
|
||||
uses rxdconst, rxstrutils, DBGrids;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
@ -125,7 +126,7 @@ end;
|
||||
|
||||
procedure TrxFilterByForm.Button3Click(Sender: TObject);
|
||||
begin
|
||||
ClearALL(Table);
|
||||
ClearALL(FGrid);
|
||||
end;
|
||||
|
||||
procedure TrxFilterByForm.ComboBoxChange(Sender: TObject);
|
||||
@ -178,23 +179,24 @@ begin
|
||||
ModalResult := mrOK;
|
||||
end;
|
||||
|
||||
procedure TrxFilterByForm.ClearALL(adoTable : TDataSet);
|
||||
procedure TrxFilterByForm.ClearALL(AGrid: TRxDBGrid);
|
||||
var
|
||||
X : Integer;
|
||||
i : Integer;
|
||||
begin
|
||||
//*****************************************************************************
|
||||
Combo_1[1].Items.Clear;
|
||||
Combo_1[1].Items.Add('');
|
||||
For X := 0 To adoTable.FieldCount-1 do
|
||||
Begin
|
||||
if (adoTable.Fields[X].FieldKind=fkData) And (adoTable.Fields[X].Visible) Then
|
||||
Combo_1[1].Items.Add(adoTable.Fields[X].FieldName);
|
||||
End;
|
||||
for i := 0 To AGrid.Columns.Count-1 do
|
||||
begin
|
||||
if (AGrid.Columns[i].Field.FieldKind=fkData) and (AGrid.Columns[i].Visible) then
|
||||
Combo_1[1].Items.Objects[Combo_1[1].Items.Add(AGrid.Columns[i].Title.Caption)]:=AGrid.Columns[i].Field;
|
||||
end;
|
||||
|
||||
Combo_1[1].ItemIndex := 0;
|
||||
For X := 2 To 9 do
|
||||
for i := 2 To 9 do
|
||||
Begin
|
||||
Combo_1[X].Items.Assign(Combo_1[1].Items);
|
||||
Combo_1[X].ItemIndex := 0;
|
||||
Combo_1[i].Items.Assign(Combo_1[1].Items);
|
||||
Combo_1[i].ItemIndex := 0;
|
||||
End;
|
||||
|
||||
Combo_2[1].Items.Clear;
|
||||
@ -208,26 +210,27 @@ begin
|
||||
Combo_2[1].Items.Add(' IS NULL ');
|
||||
Combo_2[1].Items.Add(' IS NOT NULL ');
|
||||
Combo_2[1].ItemIndex := 0;
|
||||
for X := 2 To 9 do
|
||||
for i := 2 To 9 do
|
||||
begin
|
||||
Combo_2[X].Items.Assign(Combo_2[1].Items);
|
||||
Combo_2[X].ItemIndex := 0;
|
||||
Combo_2[i].Items.Assign(Combo_2[1].Items);
|
||||
Combo_2[i].ItemIndex := 0;
|
||||
end;
|
||||
for X := 1 To 9 do
|
||||
for i := 1 To 9 do
|
||||
begin
|
||||
Combo_3[X].ItemIndex := 0;
|
||||
Combo_3[i].ItemIndex := 0;
|
||||
end;
|
||||
for X := 1 To 9 do Edit_1[X].Text := '';
|
||||
for i := 1 To 9 do Edit_1[i].Text := '';
|
||||
//*****************************************************************************
|
||||
end;
|
||||
|
||||
function TrxFilterByForm.Execute(adoTable : TDataSet; Var FilterStr : String; Var LastFilter : TstringList):Boolean;
|
||||
function TrxFilterByForm.Execute(AGrid: TRxDBGrid; var FilterStr: String;
|
||||
var LastFilter: TstringList): Boolean;
|
||||
Var
|
||||
X : Integer;
|
||||
P : Integer;
|
||||
S : String;
|
||||
S, S1 : String;
|
||||
SD : String;
|
||||
FF : TField;
|
||||
C : TColumn;
|
||||
Begin
|
||||
Result := False;
|
||||
//*****************************************************************************
|
||||
@ -273,22 +276,25 @@ Begin
|
||||
Edit_1[9] := Edit9;
|
||||
|
||||
//*****************************************************************************
|
||||
Table := adoTable;
|
||||
ClearALL(Table);
|
||||
FGrid := AGrid;
|
||||
ClearALL(FGrid);
|
||||
if LastFilter.Count > 0 Then
|
||||
Begin
|
||||
For X := 0 To LastFilter.Count-1 do
|
||||
Begin
|
||||
begin
|
||||
for X := 0 To LastFilter.Count-1 do
|
||||
begin
|
||||
S := LastFilter.Strings[X];
|
||||
P := Pos('|||',S);
|
||||
if P > 0 Then
|
||||
Begin
|
||||
Combo_1[X+1].ItemIndex := Combo_1[X+1].Items.IndexOf(System.Copy(S,1,P-1));
|
||||
begin
|
||||
S1:=System.Copy(S,1,P-1);
|
||||
C:=FGrid.ColumnByFieldName(S1);
|
||||
Combo_1[X+1].ItemIndex := Combo_1[X+1].Items.IndexOf(C.Title.Caption);
|
||||
System.Delete(S,1,P+2);
|
||||
End;
|
||||
end;
|
||||
|
||||
P := Pos('|||',S);
|
||||
if P > 0 Then
|
||||
Begin
|
||||
begin
|
||||
SD:=System.Copy(S,1,P-1);
|
||||
Combo_2[X+1].ItemIndex := Combo_2[X+1].Items.IndexOf(System.Copy(S,1,P-1));
|
||||
System.Delete(S,1,P+2);
|
||||
@ -298,65 +304,66 @@ Begin
|
||||
Edit_1[X+1].Enabled := False;
|
||||
Edit_1[X+1].Color := clInactiveCaption;
|
||||
End;
|
||||
End;
|
||||
end;
|
||||
|
||||
P := Pos('|||',S);
|
||||
if P > 0 Then
|
||||
Begin
|
||||
if P > 0 then
|
||||
begin
|
||||
Edit_1[X+1].Text := System.Copy(S,1,P-1);
|
||||
System.Delete(S,1,P+2);
|
||||
End;
|
||||
end;
|
||||
Combo_3[X+1].ItemIndex := Combo_3[X+1].Items.IndexOf(S);
|
||||
if Combo_3[X+1].ItemIndex = -1 Then Combo_3[X+1].ItemIndex := 0;
|
||||
End;
|
||||
End;
|
||||
|
||||
ShowModal;
|
||||
if ModalResult=mrOK Then
|
||||
Begin
|
||||
if Combo_3[X+1].ItemIndex = -1 Then Combo_3[X+1].ItemIndex := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
if ShowModal = mrOK Then
|
||||
begin
|
||||
Result := True;
|
||||
FilterStr := '';
|
||||
LastFilter.Clear;
|
||||
For X := 1 to 9 Do
|
||||
Begin
|
||||
if (Combo_1[X].Text <> '')
|
||||
And (Combo_2[X].Text <> '') Then
|
||||
Begin
|
||||
for X := 1 to 9 Do
|
||||
begin
|
||||
if (Combo_1[X].Text <> '') and (Combo_2[X].Text <> '') then
|
||||
begin
|
||||
if (Edit_1[X].Enabled=False) or (Edit_1[X].Text <> '') Then
|
||||
Begin
|
||||
begin
|
||||
if X>1 Then
|
||||
FilterStr := FilterStr+Combo_3[X-1].Text+' ';
|
||||
FF := Table.FindField(Combo_1[X].Text);
|
||||
Case FF.DataType of
|
||||
|
||||
C:=FGrid.ColumnByCaption(Combo_1[X].Text);
|
||||
case C.Field.DataType of
|
||||
ftDateTime ,
|
||||
ftDate : FilterStr := FilterStr+'('+Combo_1[X].Text+Combo_2[X].Text+Char(39)+Copy(Edit_1[X].Text,7,4)+Copy(Edit_1[X].Text,3,4)+Copy(Edit_1[X].Text,1,2)+Copy(Edit_1[X].Text,11,9)+Char(39)+') ';
|
||||
ftUnknown : FilterStr := FilterStr+'('+Combo_1[X].Text+Combo_2[X].Text+Edit_1[X].Text+') ';
|
||||
ftDate : FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+Char(39)+Copy(Edit_1[X].Text,7,4)+Copy(Edit_1[X].Text,3,4)+Copy(Edit_1[X].Text,1,2)+Copy(Edit_1[X].Text,11,9)+Char(39)+') ';
|
||||
ftUnknown : FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+Edit_1[X].Text+') ';
|
||||
ftTime,
|
||||
ftString,
|
||||
ftMemo : FilterStr := FilterStr+'('+Combo_1[X].Text+Combo_2[X].Text+Char(39)+Edit_1[X].Text+Char(39)+') ';
|
||||
ftMemo : FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+QuotedString(Edit_1[X].Text, '''')+') ';
|
||||
else
|
||||
FilterStr := FilterStr+'('+Combo_1[X].Text+Combo_2[X].Text+Edit_1[X].Text+') ';
|
||||
End;
|
||||
LastFilter.Add(Combo_1[X].Text+'|||'+Combo_2[X].Text+'|||'+Edit_1[X].Text+'|||'+Combo_3[X].Text);
|
||||
End;
|
||||
End;
|
||||
End;
|
||||
End;
|
||||
End;
|
||||
FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+Edit_1[X].Text+') ';
|
||||
end;
|
||||
LastFilter.Add(C.FieldName+'|||'+Combo_2[X].Text+'|||'+Edit_1[X].Text+'|||'+Combo_3[X].Text);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
Function TrxFilterByForm.FindCombo(CB:TComboBox):Integer;
|
||||
Var
|
||||
var
|
||||
X : Integer;
|
||||
Begin
|
||||
begin
|
||||
Result :=0;
|
||||
For X := 1 to 9 do
|
||||
Begin
|
||||
for X := 1 to 9 do
|
||||
begin
|
||||
if Combo_2[X]=CB Then
|
||||
Begin
|
||||
begin
|
||||
Result := X;
|
||||
Exit;
|
||||
End;
|
||||
End;
|
||||
End;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TrxFilterByForm.FindEdit(ED:TEdit):Integer;
|
||||
var
|
||||
|
@ -27,7 +27,7 @@ translate to Lazarus by alexs in 2005 - 2012
|
||||
"/>
|
||||
<License Value="LGPL"/>
|
||||
<Version Major="2" Minor="2" Release="2" Build="112"/>
|
||||
<Files Count="64">
|
||||
<Files Count="66">
|
||||
<Item1>
|
||||
<Filename Value="autopanel.pas"/>
|
||||
<UnitName Value="AutoPanel"/>
|
||||
@ -287,6 +287,14 @@ translate to Lazarus by alexs in 2005 - 2012
|
||||
<Filename Value="ex_rx_xml_datapacket.pas"/>
|
||||
<UnitName Value="ex_rx_xml_datapacket"/>
|
||||
</Item64>
|
||||
<Item65>
|
||||
<Filename Value="rxsortby.lfm"/>
|
||||
<Type Value="LFM"/>
|
||||
</Item65>
|
||||
<Item66>
|
||||
<Filename Value="rxsortby.pas"/>
|
||||
<UnitName Value="rxsortby"/>
|
||||
</Item66>
|
||||
</Files>
|
||||
<LazDoc Paths="docs;\usr\local\share\lazarus\components\rxnew\docs"/>
|
||||
<i18n>
|
||||
|
@ -18,7 +18,7 @@ uses
|
||||
RxSystemServices, rxtbrsetup, RxTimeEdit, rxtoolbar, RxVersInfo,
|
||||
RxViewsPanel, rxxpman, seldsfrm, tooledit, vclutils, RxCloseFormValidator,
|
||||
RxHistoryNavigator, ex_rx_bin_datapacket, ex_rx_datapacket,
|
||||
ex_rx_xml_datapacket, LazarusPackageIntf;
|
||||
ex_rx_xml_datapacket, rxsortby, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -7,30 +7,29 @@ object rxSortByForm: TrxSortByForm
|
||||
Caption = 'Sort by fields'
|
||||
ClientHeight = 411
|
||||
ClientWidth = 684
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.31'
|
||||
LCLVersion = '1.1'
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideLeft.Control = AddBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 6
|
||||
Height = 18
|
||||
Left = 417
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 109
|
||||
Width = 105
|
||||
BorderSpacing.Around = 6
|
||||
Caption = '&Fields for sorting:'
|
||||
FocusControl = ListBox1
|
||||
ParentColor = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
AnchorSideLeft.Control = AddBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 415
|
||||
Height = 18
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 57
|
||||
Width = 55
|
||||
BorderSpacing.Around = 6
|
||||
Caption = '&All fields:'
|
||||
FocusControl = ListBox2
|
||||
@ -41,9 +40,9 @@ object rxSortByForm: TrxSortByForm
|
||||
AnchorSideBottom.Control = ComboBox1
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 18
|
||||
Top = 318
|
||||
Width = 108
|
||||
Height = 15
|
||||
Top = 314
|
||||
Width = 104
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Select sort order'
|
||||
@ -51,22 +50,20 @@ object rxSortByForm: TrxSortByForm
|
||||
ParentColor = False
|
||||
end
|
||||
object ListBox2: TListBox
|
||||
AnchorSideLeft.Control = AddBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Label2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideRight.Control = AddBtn
|
||||
AnchorSideBottom.Control = ComboBox1
|
||||
Left = 415
|
||||
Height = 273
|
||||
Top = 30
|
||||
Width = 263
|
||||
Left = 6
|
||||
Height = 267
|
||||
Top = 27
|
||||
Width = 262
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
ItemHeight = 0
|
||||
OnDblClick = ListBox2DblClick
|
||||
ScrollWidth = 261
|
||||
ScrollWidth = 260
|
||||
TabOrder = 0
|
||||
TopIndex = -1
|
||||
end
|
||||
@ -76,10 +73,10 @@ object rxSortByForm: TrxSortByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AddBtn
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 275
|
||||
Height = 29
|
||||
Top = 65
|
||||
Width = 134
|
||||
Left = 274
|
||||
Height = 35
|
||||
Top = 68
|
||||
Width = 137
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
@ -89,18 +86,16 @@ object rxSortByForm: TrxSortByForm
|
||||
0400000000001401000000000000000000001000000010000000000000000000
|
||||
80000080000000808000800000008000800080800000C0C0C000808080000000
|
||||
C80000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
|
||||
7777777777777777777777877777777777777777777777007777777777777777
|
||||
7777770907777777777777777777770990777777777777777777770999077777
|
||||
7777777777777709999077777777777800000009999907777777777099999999
|
||||
9999907777777770999999999999990777777770999999999999999077777770
|
||||
9999999999999999F7777770999999999999999F7777777099999999999999F7
|
||||
777777709999999999999F7777777778FFFFFF899999F7777777777777777789
|
||||
999F7777777777777777778999F7777777777777777777899F77777777777777
|
||||
77777789F7777777777777777777778F7777777777777777777777F777777777
|
||||
7777777777777777777777777877777777777777777777770077777777777777
|
||||
7777777090777777777777777777770990777777777777777777709990777777
|
||||
7777777777770999907777777777777777709999900000008777777777099999
|
||||
999999990777777770999999999999990777777709999999999999990777777F
|
||||
999999999999999907777777F999999999999999077777777F99999999999999
|
||||
0777777777F999999999999907777777777F999998FFFFFF877777777777F999
|
||||
987777777777777777777F999877777777777777777777F99877777777777777
|
||||
7777777F987777777777777777777777F877777777777777777777777F777777
|
||||
7777777777777777777777777777
|
||||
}
|
||||
Layout = blGlyphRight
|
||||
NumGlyphs = 0
|
||||
OnClick = RemoveBtnClick
|
||||
TabOrder = 2
|
||||
end
|
||||
@ -110,10 +105,10 @@ object rxSortByForm: TrxSortByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AddBtn
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 275
|
||||
Height = 30
|
||||
Top = 100
|
||||
Width = 134
|
||||
Left = 274
|
||||
Height = 36
|
||||
Top = 109
|
||||
Width = 137
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
@ -133,7 +128,6 @@ object rxSortByForm: TrxSortByForm
|
||||
77777709F7777777777077777777777F77777777777077777777777777777777
|
||||
7770777777777777777777777770777777777777777777777770
|
||||
}
|
||||
NumGlyphs = 0
|
||||
OnClick = UpBtnClick
|
||||
TabOrder = 3
|
||||
end
|
||||
@ -143,10 +137,10 @@ object rxSortByForm: TrxSortByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AddBtn
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 275
|
||||
Height = 30
|
||||
Top = 136
|
||||
Width = 134
|
||||
Left = 274
|
||||
Height = 36
|
||||
Top = 151
|
||||
Width = 137
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
@ -166,7 +160,6 @@ object rxSortByForm: TrxSortByForm
|
||||
77709999999F7777777077777778000000087777777077777777777777777777
|
||||
7770777777777777777777777770777777777777777777777770
|
||||
}
|
||||
NumGlyphs = 0
|
||||
OnClick = DownBtnClick
|
||||
TabOrder = 4
|
||||
end
|
||||
@ -176,10 +169,10 @@ object rxSortByForm: TrxSortByForm
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = CheckBox1
|
||||
Left = 120
|
||||
Height = 27
|
||||
Top = 309
|
||||
Width = 558
|
||||
Left = 116
|
||||
Height = 29
|
||||
Top = 300
|
||||
Width = 562
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
ItemHeight = 0
|
||||
@ -187,20 +180,22 @@ object rxSortByForm: TrxSortByForm
|
||||
TabOrder = 5
|
||||
end
|
||||
object ListBox1: TListBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideLeft.Control = AddBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AddBtn
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ComboBox1
|
||||
Left = 6
|
||||
Height = 273
|
||||
Top = 30
|
||||
Width = 263
|
||||
Left = 417
|
||||
Height = 267
|
||||
Top = 27
|
||||
Width = 261
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
ItemHeight = 0
|
||||
OnDblClick = ListBox1DblClick
|
||||
ScrollWidth = 261
|
||||
ScrollWidth = 259
|
||||
TabOrder = 6
|
||||
TopIndex = -1
|
||||
end
|
||||
@ -208,10 +203,10 @@ object rxSortByForm: TrxSortByForm
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = ListBox1
|
||||
Left = 275
|
||||
Height = 29
|
||||
Top = 30
|
||||
Width = 134
|
||||
Left = 274
|
||||
Height = 35
|
||||
Top = 27
|
||||
Width = 137
|
||||
AutoSize = True
|
||||
Caption = '&Add field to sort'
|
||||
Glyph.Data = {
|
||||
@ -219,33 +214,33 @@ object rxSortByForm: TrxSortByForm
|
||||
0400000000001401000000000000000000001000000010000000000000000000
|
||||
80000080000000808000800000008000800080800000C0C0C000808080000000
|
||||
C80000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
|
||||
7777777777777777777777777877777777777777777777770077777777777777
|
||||
7777777090777777777777777777770990777777777777777777709990777777
|
||||
7777777777770999907777777777777777709999900000008777777777099999
|
||||
999999990777777770999999999999990777777709999999999999990777777F
|
||||
999999999999999907777777F999999999999999077777777F99999999999999
|
||||
0777777777F999999999999907777777777F999998FFFFFF877777777777F999
|
||||
987777777777777777777F999877777777777777777777F99877777777777777
|
||||
7777777F987777777777777777777777F877777777777777777777777F777777
|
||||
7777777777777777777777877777777777777777777777007777777777777777
|
||||
7777770907777777777777777777770990777777777777777777770999077777
|
||||
7777777777777709999077777777777800000009999907777777777099999999
|
||||
9999907777777770999999999999990777777770999999999999999077777770
|
||||
9999999999999999F7777770999999999999999F7777777099999999999999F7
|
||||
777777709999999999999F7777777778FFFFFF899999F7777777777777777789
|
||||
999F7777777777777777778999F7777777777777777777899F77777777777777
|
||||
77777789F7777777777777777777778F7777777777777777777777F777777777
|
||||
7777777777777777777777777777
|
||||
}
|
||||
NumGlyphs = 0
|
||||
Layout = blGlyphRight
|
||||
OnClick = AddBtnClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 36
|
||||
Top = 369
|
||||
Height = 42
|
||||
Top = 363
|
||||
Width = 672
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.Caption = '&ОК'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
HelpButton.Caption = '&Справка'
|
||||
HelpButton.DefaultCaption = True
|
||||
CloseButton.Name = 'CloseButton'
|
||||
CloseButton.Caption = '&Закрыть'
|
||||
CloseButton.DefaultCaption = True
|
||||
CancelButton.Name = 'CancelButton'
|
||||
CancelButton.Caption = 'Отмена'
|
||||
CancelButton.DefaultCaption = True
|
||||
TabOrder = 7
|
||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
||||
end
|
||||
@ -255,9 +250,9 @@ object rxSortByForm: TrxSortByForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonPanel1
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 342
|
||||
Width = 155
|
||||
Height = 22
|
||||
Top = 335
|
||||
Width = 151
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Case insensitive sort'
|
||||
|
@ -31,13 +31,13 @@
|
||||
|
||||
unit rxsortby;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$I rx.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Buttons, ButtonPanel, db;
|
||||
StdCtrls, Buttons, ButtonPanel, rxdbgrid, db;
|
||||
|
||||
type
|
||||
|
||||
@ -58,25 +58,23 @@ type
|
||||
UpBtn: TBitBtn;
|
||||
procedure AddBtnClick(Sender: TObject);
|
||||
procedure DownBtnClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ListBox1DblClick(Sender: TObject);
|
||||
procedure ListBox2DblClick(Sender: TObject);
|
||||
procedure RemoveBtnClick(Sender: TObject);
|
||||
procedure UpBtnClick(Sender: TObject);
|
||||
private
|
||||
OrderListTemp: TStringList;
|
||||
OrderAsc:boolean;
|
||||
|
||||
public
|
||||
{ public declarations }
|
||||
function Execute(adoTable : TDataSet; SortFieldNames:TStringList; var Asc:boolean):Boolean;
|
||||
function Execute(ADBGrid:TRxDBGrid; SortFieldNames:TStringList; var Asc:boolean):Boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
rxSortByForm: TrxSortByForm;
|
||||
|
||||
implementation
|
||||
uses rxdconst;
|
||||
uses rxdconst, DBGrids;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
@ -85,29 +83,22 @@ uses rxdconst;
|
||||
procedure TrxSortByForm.DownBtnClick(Sender: TObject);
|
||||
var
|
||||
TmpField:String;
|
||||
C1:TObject;
|
||||
Poz: Integer;
|
||||
begin
|
||||
if ListBox1.ItemIndex < ListBox1.Items.Count-1 Then
|
||||
begin
|
||||
Poz:=ListBox1.ItemIndex;
|
||||
TmpField:=ListBox1.Items[Poz+1];
|
||||
ListBox1.Items[Poz+1]:=ListBox1.Items[Poz];
|
||||
ListBox1.Items[Poz]:=TmpField;
|
||||
ListBox1.ItemIndex:=Poz+1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TrxSortByForm.FormClose(Sender: TObject; var CloseAction: TCloseAction
|
||||
);
|
||||
var
|
||||
X:Integer;
|
||||
begin
|
||||
if ModalResult = mrOk then
|
||||
begin
|
||||
OrderAsc:=(ComboBox1.ItemIndex=0);
|
||||
OrderListTemp.Clear;
|
||||
for X:=0 To ListBox1.Items.Count-1 do
|
||||
OrderListTemp.Add(ListBox1.Items[X]);
|
||||
TmpField:=ListBox1.Items[Poz+1];
|
||||
C1:=ListBox1.Items.Objects[Poz+1];
|
||||
|
||||
ListBox1.Items[Poz+1]:=ListBox1.Items[Poz];
|
||||
ListBox1.Items.Objects[Poz+1]:=ListBox1.Items.Objects[Poz];
|
||||
|
||||
ListBox1.Items[Poz]:=TmpField;
|
||||
ListBox1.Items.Objects[Poz]:=C1;
|
||||
ListBox1.ItemIndex:=Poz+1;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -143,7 +134,7 @@ procedure TrxSortByForm.AddBtnClick(Sender: TObject);
|
||||
begin
|
||||
if ListBox2.ItemIndex <> -1 Then
|
||||
begin
|
||||
ListBox1.Items.Add(ListBox2.Items.Strings[ListBox2.ItemIndex]);
|
||||
ListBox1.Items.Objects[ListBox1.Items.Add(ListBox2.Items[ListBox2.ItemIndex])]:=ListBox2.Items.Objects[ListBox2.ItemIndex];
|
||||
ListBox2.Items.Delete(ListBox2.ItemIndex);
|
||||
ListBox1.ItemIndex:=ListBox1.Items.Count-1;
|
||||
end;
|
||||
@ -153,7 +144,7 @@ procedure TrxSortByForm.RemoveBtnClick(Sender: TObject);
|
||||
begin
|
||||
if ListBox1.ItemIndex <> -1 Then
|
||||
begin
|
||||
ListBox2.Items.Add(ListBox1.Items.Strings[ListBox1.ItemIndex]);
|
||||
ListBox2.Items.Objects[ListBox2.Items.Add(ListBox1.Items[ListBox1.ItemIndex])]:=ListBox1.Items.Objects[ListBox1.ItemIndex];
|
||||
ListBox1.Items.Delete(ListBox1.ItemIndex);
|
||||
end;
|
||||
end;
|
||||
@ -162,61 +153,66 @@ procedure TrxSortByForm.UpBtnClick(Sender: TObject);
|
||||
var
|
||||
TmpField:String;
|
||||
Poz : Integer;
|
||||
C1:TObject;
|
||||
begin
|
||||
if ListBox1.ItemIndex > 0 Then
|
||||
begin
|
||||
Poz:=ListBox1.ItemIndex;
|
||||
TmpField:=ListBox1.Items[Poz-1];
|
||||
C1:=ListBox1.Items.Objects[Poz-1];
|
||||
|
||||
ListBox1.Items[Poz-1]:=ListBox1.Items[Poz];
|
||||
ListBox1.Items.Objects[Poz-1]:=ListBox1.Items.Objects[Poz];
|
||||
|
||||
ListBox1.Items[Poz]:=TmpField;
|
||||
ListBox1.Items.Objects[Poz]:=C1;
|
||||
|
||||
ListBox1.ItemIndex:=Poz-1;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TrxSortByForm.Execute(adoTable : TDataSet; SortFieldNames: TStringList; var Asc:boolean): Boolean;
|
||||
function TrxSortByForm.Execute(ADBGrid: TRxDBGrid;
|
||||
SortFieldNames: TStringList; var Asc: boolean): Boolean;
|
||||
var
|
||||
X,P : Integer;
|
||||
i, j : Integer;
|
||||
S : String;
|
||||
SortFieldNamesTmp : TStringList;
|
||||
C:TColumn;
|
||||
begin
|
||||
Result:=False;
|
||||
if not (Assigned(ADBGrid.DataSource) and Assigned(ADBGrid.DataSource.DataSet) and ADBGrid.DataSource.DataSet.Active) then exit;
|
||||
ListBox1.Clear;
|
||||
ListBox2.Clear;
|
||||
|
||||
if not Asc then
|
||||
ComboBox1.ItemIndex:=1
|
||||
else
|
||||
ComboBox1.ItemIndex:=0;
|
||||
SortFieldNamesTmp:=TStringList.Create;
|
||||
for X:=0 to adoTable.FieldDefs.Count-1 do
|
||||
// If (NOT adoTable.FieldDefs[X].FieldClass.IsBlob) Then
|
||||
SortFieldNamesTmp.Add(adoTable.FieldDefs.Items[X].Name);
|
||||
if SortFieldNames.Count > 0 Then
|
||||
begin
|
||||
ListBox1.Clear;
|
||||
for X:=0 To SortFieldNames.Count-1 Do
|
||||
begin
|
||||
S:=SortFieldNames.Strings[X];
|
||||
ListBox1.Items.Add(S);
|
||||
P:=SortFieldNamesTmp.IndexOF(SortFieldNames.Strings[X]);
|
||||
if P > -1 then
|
||||
SortFieldNamesTmp.Delete(P);
|
||||
end;
|
||||
end;
|
||||
if SortFieldNamesTmp.Count > 0 then
|
||||
begin
|
||||
ListBox2.Clear;
|
||||
for X:=0 To SortFieldNamesTmp.Count-1 do
|
||||
ListBox2.Items.Add(SortFieldNamesTmp.Strings[X]);
|
||||
end;
|
||||
SortFieldNamesTmp.Free;
|
||||
|
||||
OrderListTemp:=SortFieldNames;
|
||||
OrderAsc:=Asc;
|
||||
for i:=0 to ADBGrid.Columns.Count-1 do
|
||||
begin
|
||||
C:=ADBGrid.Columns[i];
|
||||
if SortFieldNames.IndexOf(C.Field.FieldName) > -1 then
|
||||
ListBox1.Items.Objects[ListBox1.Items.Add(C.Title.Caption)]:=C
|
||||
else
|
||||
ListBox2.Items.Objects[ListBox2.Items.Add(C.Title.Caption)]:=C;
|
||||
end;
|
||||
|
||||
if ShowModal = mrOK Then
|
||||
begin
|
||||
Asc:=OrderAsc;
|
||||
Asc:= ComboBox1.ItemIndex = 0;
|
||||
|
||||
SortFieldNames.Clear;
|
||||
for i:=0 to ListBox1.Items.Count-1 do
|
||||
begin
|
||||
C:=ListBox1.Items.Objects[i] as TColumn;
|
||||
SortFieldNames.Add(C.FieldName);
|
||||
end;
|
||||
|
||||
Result:=True;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user