RxDBGrid - redesing CollumnDialog

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3059 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2014-05-19 12:41:29 +00:00
parent 44a02408aa
commit acdbfd899b
12 changed files with 394 additions and 227 deletions

View File

@ -54,7 +54,7 @@
<MinVersion Major="1" Release="18" Build="56" Valid="True"/> <MinVersion Major="1" Release="18" Build="56" Valid="True"/>
</Item4> </Item4>
</RequiredPackages> </RequiredPackages>
<Units Count="102"> <Units Count="101">
<Unit0> <Unit0>
<Filename Value="RxDBGridDemo.lpr"/> <Filename Value="RxDBGridDemo.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -62,7 +62,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="9" Y="16"/> <CursorPos X="9" Y="16"/>
<UsageCount Value="97"/> <UsageCount Value="99"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="rxdbgridmainunit.pas"/> <Filename Value="rxdbgridmainunit.pas"/>
@ -75,7 +75,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="62"/> <TopLine Value="62"/>
<CursorPos X="15" Y="76"/> <CursorPos X="15" Y="76"/>
<UsageCount Value="97"/> <UsageCount Value="99"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit1> </Unit1>
@ -102,12 +102,11 @@
<Unit5> <Unit5>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid.pas"/>
<UnitName Value="rxdbgrid"/> <UnitName Value="rxdbgrid"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="3367"/> <TopLine Value="4823"/>
<CursorPos X="1" Y="3397"/> <CursorPos X="3" Y="4826"/>
<UsageCount Value="16"/> <UsageCount Value="17"/>
<Bookmarks Count="2"> <Bookmarks Count="2">
<Item0 X="1" Y="2564" ID="2"/> <Item0 X="1" Y="2564" ID="2"/>
<Item1 X="1" Y="4791" ID="1"/> <Item1 X="1" Y="4791" ID="1"/>
@ -193,18 +192,23 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="rxdbgrid_columsunit"/> <UnitName Value="rxdbgrid_columsunit"/>
<TopLine Value="26"/> <IsVisibleTab Value="True"/>
<CursorPos X="46" Y="45"/> <EditorIndex Value="2"/>
<UsageCount Value="5"/> <WindowIndex Value="0"/>
<TopLine Value="78"/>
<CursorPos X="1" Y="166"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="../../rxdconst.pas"/> <Filename Value="../../rxdconst.pas"/>
<UnitName Value="rxdconst"/> <UnitName Value="rxdconst"/>
<EditorIndex Value="2"/> <EditorIndex Value="4"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="98"/> <TopLine Value="144"/>
<CursorPos X="31" Y="114"/> <CursorPos X="21" Y="165"/>
<UsageCount Value="10"/> <UsageCount Value="11"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
@ -503,21 +507,21 @@
<Unit58> <Unit58>
<Filename Value="../../../../lcl/dbgrids.pas"/> <Filename Value="../../../../lcl/dbgrids.pas"/>
<UnitName Value="DBGrids"/> <UnitName Value="DBGrids"/>
<EditorIndex Value="3"/> <EditorIndex Value="5"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="222"/> <TopLine Value="222"/>
<CursorPos X="3" Y="216"/> <CursorPos X="3" Y="216"/>
<UsageCount Value="18"/> <UsageCount Value="19"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit58> </Unit58>
<Unit59> <Unit59>
<Filename Value="../../../../lcl/grids.pas"/> <Filename Value="../../../../lcl/grids.pas"/>
<UnitName Value="Grids"/> <UnitName Value="Grids"/>
<EditorIndex Value="4"/> <EditorIndex Value="6"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="515"/> <TopLine Value="1562"/>
<CursorPos X="1" Y="529"/> <CursorPos X="16" Y="1583"/>
<UsageCount Value="21"/> <UsageCount Value="22"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="23" Y="7562" ID="3"/> <Item0 X="23" Y="7562" ID="3"/>
</Bookmarks> </Bookmarks>
@ -801,169 +805,165 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit95> </Unit95>
<Unit96> <Unit96>
<Filename Value="/home/alexs/install/source/fpcsrc/rtl/objpas/classes/classesh.inc"/> <Filename Value="../../../../../../install/source/fpcsrc/rtl/objpas/classes/classes.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="412"/>
<CursorPos X="3" Y="427"/>
<UsageCount Value="10"/>
</Unit96>
<Unit97>
<Filename Value="/home/alexs/install/source/fpcsrc/rtl/objpas/classes/classes.inc"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="846"/> <TopLine Value="846"/>
<CursorPos X="3" Y="851"/> <CursorPos X="3" Y="851"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit97> </Unit96>
<Unit98> <Unit97>
<Filename Value="../../../../lcl/clipbrd.pp"/> <Filename Value="../../../../lcl/clipbrd.pp"/>
<UnitName Value="Clipbrd"/> <UnitName Value="Clipbrd"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="176"/> <TopLine Value="176"/>
<CursorPos X="15" Y="190"/> <CursorPos X="15" Y="190"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit98> </Unit97>
<Unit99> <Unit98>
<Filename Value="../../../../lcl/include/clipbrd.inc"/> <Filename Value="../../../../lcl/include/clipbrd.inc"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="178"/> <TopLine Value="178"/>
<CursorPos X="3" Y="180"/> <CursorPos X="3" Y="180"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit99> </Unit98>
<Unit100> <Unit99>
<Filename Value="/home/alexs/install/source/fpcsrc/rtl/objpas/classes/collect.inc"/> <Filename Value="../../../../../../install/source/fpcsrc/rtl/inc/objpash.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="153"/>
<CursorPos X="3" Y="156"/>
<UsageCount Value="10"/>
</Unit100>
<Unit101>
<Filename Value="/home/alexs/install/source/fpcsrc/rtl/inc/objpash.inc"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="178"/> <TopLine Value="178"/>
<CursorPos X="23" Y="193"/> <CursorPos X="23" Y="193"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit101> </Unit99>
<Unit100>
<Filename Value="../../../../lcl/buttonpanel.pas"/>
<UnitName Value="ButtonPanel"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="339"/>
<CursorPos X="1" Y="349"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit100>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="28"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="4309" Column="1" TopLine="4290"/> <Caret Line="182" Column="1" TopLine="147"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="4310" Column="1" TopLine="4290"/> <Caret Line="183" Column="1" TopLine="147"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="4312" Column="1" TopLine="4290"/> <Caret Line="176" Column="1" TopLine="147"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="176" Column="1" TopLine="148"/> <Caret Line="178" Column="1" TopLine="147"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="168" Column="45" TopLine="155"/> <Caret Line="179" Column="1" TopLine="147"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="162" Column="25" TopLine="157"/> <Caret Line="181" Column="1" TopLine="147"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="173" Column="64" TopLine="149"/> <Caret Line="182" Column="21" TopLine="147"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="435" Column="53" TopLine="399"/> <Caret Line="133" Column="10" TopLine="96"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="1" Column="1" TopLine="1"/> <Caret Line="124" Column="8" TopLine="101"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="671" Column="30" TopLine="647"/> <Caret Line="158" Column="40" TopLine="118"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="165" Column="26" TopLine="149"/> <Caret Line="120" Column="36" TopLine="111"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="173" Column="63" TopLine="149"/> <Caret Line="165" Column="3" TopLine="163"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="160" Column="17" TopLine="155"/> <Caret Line="167" Column="1" TopLine="158"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="437" Column="94" TopLine="411"/> <Caret Line="166" Column="88" TopLine="162"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="4699" Column="29" TopLine="4697"/> <Caret Line="69" Column="20" TopLine="56"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="160" Column="15" TopLine="153"/> <Caret Line="166" Column="98" TopLine="145"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="448" Column="45" TopLine="421"/> <Caret Line="151" Column="54" TopLine="106"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="4775" Column="23" TopLine="4766"/> <Caret Line="121" Column="1" TopLine="106"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="403" Column="16" TopLine="399"/> <Caret Line="137" Column="1" TopLine="106"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="../../../../lcl/dbgrids.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="216" Column="3" TopLine="210"/> <Caret Line="121" Column="1" TopLine="106"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="../../../../lcl/grids.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="11296" Column="3" TopLine="11292"/> <Caret Line="123" Column="1" TopLine="106"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="430" Column="39" TopLine="405"/> <Caret Line="124" Column="1" TopLine="106"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="4772" Column="33" TopLine="4767"/> <Caret Line="125" Column="1" TopLine="106"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="734" Column="1" TopLine="730"/> <Caret Line="156" Column="45" TopLine="121"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="1" Column="1" TopLine="1"/> <Caret Line="166" Column="1" TopLine="139"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="164" Column="84" TopLine="150"/> <Caret Line="168" Column="116" TopLine="147"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="168" Column="32" TopLine="158"/> <Caret Line="166" Column="1" TopLine="147"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="1" Column="1" TopLine="1"/> <Caret Line="169" Column="1" TopLine="147"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="3386" Column="5" TopLine="3358"/> <Caret Line="167" Column="1" TopLine="147"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid_columsunit.pas"/>
<Caret Line="3349" Column="49" TopLine="3333"/> <Caret Line="166" Column="80" TopLine="138"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>

View File

@ -123,16 +123,20 @@ procedure CreateSubItems;
var var
i:integer; i:integer;
M:TMenuItem; M:TMenuItem;
S:string;
begin begin
for i:=0 to AFolderList.Count-1 do for i:=0 to AFolderList.Count-1 do
begin begin
M:=TMenuItem.Create(Application.MainForm); M:=TMenuItem.Create(Application.MainForm);
M.Caption:=MenuItemStr(AFolderList[i]); S:=AFolderList[i];
M.Caption:=MenuItemStr(S);
MenuItem.Add(M); MenuItem.Add(M);
DoFind(AFolderList[i]+DirectorySeparator,M); DoFind(AFolderList[i]+DirectorySeparator,M);
end; end;
end; end;
var
SS:string;
begin begin
AFolderList:=TStringList.Create; AFolderList:=TStringList.Create;
AFolderList.Sorted:=true; AFolderList.Sorted:=true;
@ -143,11 +147,17 @@ begin
while R=0 do while R=0 do
begin begin
if ((Rec.Attr and faDirectory) <>0) and (Rec.Name<>'.') and (Rec.Name<>'..') then if ((Rec.Attr and faDirectory) <>0) and (Rec.Name<>'.') and (Rec.Name<>'..') then
AFolderList.Add(S+Rec.Name) begin
SS:=S+Rec.Name;
AFolderList.Add(SS)
end
else else
begin begin
if UTF8LowerCase(ExtractFileExt(Rec.Name))=UTF8LowerCase(FDefaultExt) then if UTF8LowerCase(ExtractFileExt(Rec.Name))=UTF8LowerCase(FDefaultExt) then
AFileList.Add(S+Rec.Name); begin
SS:=S+Rec.Name;
AFileList.Add(SS);
end;
end; end;
R:=FindNextUTF8(Rec); R:=FindNextUTF8(Rec);
end; end;

View File

@ -294,6 +294,15 @@ msgstr "Hacia Delante"
msgid "Text to find" msgid "Text to find"
msgstr "Texto a Buscar" msgstr "Texto a Buscar"
#: rxdconst.srxdbgridselapplycaption
msgctxt "rxdconst.srxdbgridselapplycaption"
msgid "Apply"
msgstr "Aceptar"
#: rxdconst.srxdbgridselapplyhint
msgid "Apply current columns setings"
msgstr ""
#: rxdconst.srxdbgridselcolcaption #: rxdconst.srxdbgridselcolcaption
msgid "Grid columns" msgid "Grid columns"
msgstr "Columnas de la Tabla" msgstr "Columnas de la Tabla"
@ -335,6 +344,7 @@ msgid "Fill fields in SortField property"
msgstr "" msgstr ""
#: rxdconst.srxfilterformapply #: rxdconst.srxfilterformapply
msgctxt "rxdconst.srxfilterformapply"
msgid "Apply" msgid "Apply"
msgstr "Aceptar" msgstr "Aceptar"

View File

@ -292,6 +292,15 @@ msgstr ""
msgid "Text to find" msgid "Text to find"
msgstr "" msgstr ""
#: rxdconst.srxdbgridselapplycaption
msgctxt "rxdconst.srxdbgridselapplycaption"
msgid "Apply"
msgstr ""
#: rxdconst.srxdbgridselapplyhint
msgid "Apply current columns setings"
msgstr ""
#: rxdconst.srxdbgridselcolcaption #: rxdconst.srxdbgridselcolcaption
msgid "Grid columns" msgid "Grid columns"
msgstr "" msgstr ""
@ -333,6 +342,7 @@ msgid "Fill fields in SortField property"
msgstr "" msgstr ""
#: rxdconst.srxfilterformapply #: rxdconst.srxfilterformapply
msgctxt "rxdconst.srxfilterformapply"
msgid "Apply" msgid "Apply"
msgstr "" msgstr ""

View File

@ -294,6 +294,15 @@ msgstr "Вперёд"
msgid "Text to find" msgid "Text to find"
msgstr "Текст для поиска" msgstr "Текст для поиска"
#: rxdconst.srxdbgridselapplycaption
msgctxt "rxdconst.srxdbgridselapplycaption"
msgid "Apply"
msgstr "Применить"
#: rxdconst.srxdbgridselapplyhint
msgid "Apply current columns setings"
msgstr ""
#: rxdconst.srxdbgridselcolcaption #: rxdconst.srxdbgridselcolcaption
msgid "Grid columns" msgid "Grid columns"
msgstr "Поля таблицы" msgstr "Поля таблицы"
@ -335,6 +344,7 @@ msgid "Fill fields in SortField property"
msgstr "" msgstr ""
#: rxdconst.srxfilterformapply #: rxdconst.srxfilterformapply
msgctxt "rxdconst.srxfilterformapply"
msgid "Apply" msgid "Apply"
msgstr "Применить" msgstr "Применить"

View File

@ -303,6 +303,15 @@ msgstr "Вперед"
msgid "Text to find" msgid "Text to find"
msgstr "Текст для пошуку" msgstr "Текст для пошуку"
#: rxdconst.srxdbgridselapplycaption
msgctxt "rxdconst.srxdbgridselapplycaption"
msgid "Apply"
msgstr "Застосувати"
#: rxdconst.srxdbgridselapplyhint
msgid "Apply current columns setings"
msgstr ""
#: rxdconst.srxdbgridselcolcaption #: rxdconst.srxdbgridselcolcaption
msgid "Grid columns" msgid "Grid columns"
msgstr "Поля таблиці" msgstr "Поля таблиці"
@ -344,6 +353,7 @@ msgid "Fill fields in SortField property"
msgstr "" msgstr ""
#: rxdconst.srxfilterformapply #: rxdconst.srxfilterformapply
msgctxt "rxdconst.srxfilterformapply"
msgid "Apply" msgid "Apply"
msgstr "Застосувати" msgstr "Застосувати"

View File

@ -4083,7 +4083,7 @@ var
P_26: TBookmark; P_26: TBookmark;
{$ENDIF} {$ENDIF}
P: TBookmark; P: TBookmark;
i, cnt: integer; i, cnt, K: integer;
APresent: boolean; APresent: boolean;
DHL:THackDataLink; DHL:THackDataLink;
@ -4163,10 +4163,11 @@ begin
begin begin
RCol:=TRxColumn(Columns[i]); RCol:=TRxColumn(Columns[i]);
if RCol.Footer.ValueType = fvtCount then if RCol.Footer.ValueType = fvtCount then
RCol.Footer.FCountRec:=Cnt; //( DHS.FieldByName(RCol.Footer.FieldName).Value); RCol.Footer.FCountRec:=Cnt;
end; end;
DHS.RecNo := Min(DHL.RecordCount + SavePos + 1, DHS.RecNo); DHS.RecNo := Min(DHL.RecordCount + SavePos - 1, DHS.RecNo);
K:=DHS.RecNo;
// DHS.RecNo := SavePos; // DHS.RecNo := SavePos;
while not DHS.BOF do while not DHS.BOF do

View File

@ -1,37 +1,20 @@
object rxDBGridColumsForm: TrxDBGridColumsForm object rxDBGridColumsForm: TrxDBGridColumsForm
Left = 489 Left = 489
Height = 375 Height = 505
Top = 248 Top = 248
Width = 448 Width = 481
ActiveControl = CheckListBox1
Caption = 'Grid colums' Caption = 'Grid colums'
ClientHeight = 375 ClientHeight = 505
ClientWidth = 448 ClientWidth = 481
OnCreate = FormCreate OnCreate = FormCreate
Position = poScreenCenter Position = poScreenCenter
ShowHint = True ShowHint = True
LCLVersion = '0.9.31' LCLVersion = '1.3'
object CheckListBox1: TCheckListBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonPanel1
Left = 6
Height = 315
Top = 6
Width = 436
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
ItemHeight = 0
TabOrder = 0
TopIndex = -1
end
object ButtonPanel1: TButtonPanel object ButtonPanel1: TButtonPanel
Left = 6 Left = 6
Height = 42 Height = 41
Top = 327 Top = 458
Width = 436 Width = 469
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton' HelpButton.Name = 'HelpButton'
@ -40,16 +23,16 @@ object rxDBGridColumsForm: TrxDBGridColumsForm
CloseButton.DefaultCaption = True CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton' CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True CancelButton.DefaultCaption = True
TabOrder = 1 TabOrder = 0
ShowButtons = [pbOK, pbCancel, pbHelp] ShowButtons = [pbOK, pbCancel, pbHelp]
object SpeedButton2: TSpeedButton object sbDown: TSpeedButton
AnchorSideLeft.Control = SpeedButton1 AnchorSideLeft.Control = sbUp
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = SpeedButton1 AnchorSideTop.Control = sbUp
AnchorSideBottom.Control = SpeedButton1 AnchorSideBottom.Control = sbUp
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 143 Left = 516
Height = 34 Height = 33
Top = 0 Top = 0
Width = 23 Width = 23
Anchors = [akTop, akLeft, akBottom] Anchors = [akTop, akLeft, akBottom]
@ -90,15 +73,15 @@ object rxDBGridColumsForm: TrxDBGridColumsForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000
} }
NumGlyphs = 0 OnClick = sbDownClick
OnClick = SpeedButton2Click
end end
object SpeedButton1: TSpeedButton object sbUp: TSpeedButton
AnchorSideLeft.Control = ButtonPanel1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ButtonPanel1 AnchorSideTop.Control = ButtonPanel1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 114 Left = 487
Height = 34 Height = 33
Top = 0 Top = 0
Width = 23 Width = 23
Anchors = [akTop, akLeft, akBottom] Anchors = [akTop, akLeft, akBottom]
@ -139,8 +122,97 @@ object rxDBGridColumsForm: TrxDBGridColumsForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000
} }
NumGlyphs = 0 OnClick = sbUpClick
OnClick = SpeedButton1Click
end end
object btnApply: TBitBtn
AnchorSideBottom.Side = asrBottom
Left = 150
Height = 30
Top = 0
Width = 71
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 6
Caption = 'btnApply'
OnClick = btnApplyClick
TabOrder = 4
end
end
object StringGrid1: TStringGrid
Left = 6
Height = 446
Top = 6
Width = 469
Align = alClient
AlternateColor = clCream
AutoFillColumns = True
BorderSpacing.Around = 6
ColCount = 3
Columns = <
item
ButtonStyle = cbsCheckboxColumn
ReadOnly = False
SizePriority = 0
Title.Alignment = taCenter
Title.Caption = '...'
Title.MultiLine = False
Width = 30
end
item
Alignment = taLeftJustify
ButtonStyle = cbsNone
ReadOnly = True
Title.Caption = 'Caption'
Title.MultiLine = False
Width = 377
end
item
Alignment = taRightJustify
SizePriority = 0
Title.Alignment = taCenter
Title.Caption = 'Width'
Title.MultiLine = False
Width = 60
end>
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goEditing, goRowSelect, goRowHighlight]
TabOrder = 1
TitleStyle = tsNative
OnValidateEntry = StringGrid1ValidateEntry
ColWidths = (
30
377
60
)
Cells = (
9
0
2
'1'
0
4
'1'
1
1
'1'
1
2
'2'
1
3
'3'
1
4
'4'
2
2
'11'
2
3
'11'
2
4
'11'
)
end end
end end

View File

@ -37,20 +37,24 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, CheckLst, Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, CheckLst,
StdCtrls, Buttons, ButtonPanel, rxdbgrid; StdCtrls, Buttons, ButtonPanel, Grids, rxdbgrid;
type type
{ TrxDBGridColumsForm } { TrxDBGridColumsForm }
TrxDBGridColumsForm = class(TForm) TrxDBGridColumsForm = class(TForm)
btnApply: TBitBtn;
ButtonPanel1: TButtonPanel; ButtonPanel1: TButtonPanel;
CheckListBox1: TCheckListBox; sbUp: TSpeedButton;
SpeedButton1: TSpeedButton; sbDown: TSpeedButton;
SpeedButton2: TSpeedButton; StringGrid1: TStringGrid;
procedure btnApplyClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject); procedure sbUpClick(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject); procedure sbDownClick(Sender: TObject);
procedure StringGrid1ValidateEntry(sender: TObject; aCol, aRow: Integer;
const OldValue: string; var NewValue: String);
private private
FGrid:TRxDBGrid; FGrid:TRxDBGrid;
procedure SetGrid(AGrid:TRxDBGrid); procedure SetGrid(AGrid:TRxDBGrid);
@ -62,7 +66,7 @@ type
procedure ShowRxDBGridColumsForm(Grid:TRxDBGrid); procedure ShowRxDBGridColumsForm(Grid:TRxDBGrid);
implementation implementation
uses rxdconst; uses rxdconst, math;
{$R *.lfm} {$R *.lfm}
@ -84,66 +88,102 @@ end;
procedure TrxDBGridColumsForm.FormCreate(Sender: TObject); procedure TrxDBGridColumsForm.FormCreate(Sender: TObject);
begin begin
SpeedButton1.AnchorSideLeft.Control:=ButtonPanel1.HelpButton; sbUp.AnchorSideLeft.Control:=ButtonPanel1.HelpButton;
SpeedButton1.AnchorSideTop.Control:=ButtonPanel1.HelpButton; sbUp.AnchorSideTop.Control:=ButtonPanel1.HelpButton;
SpeedButton1.AnchorSideBottom.Control:=ButtonPanel1.HelpButton; sbUp.AnchorSideBottom.Control:=ButtonPanel1.HelpButton;
btnApply.AnchorSideTop.Control:=ButtonPanel1.OKButton;
btnApply.AnchorSideBottom.Control:=ButtonPanel1.OKButton;
{$IFDEF UNIX}
btnApply.AnchorSideRight.Control:=ButtonPanel1.CancelButton;
{$ELSE}
btnApply.AnchorSideRight.Control:=ButtonPanel1.OKButton;
{$ENDIF}
Caption:=sRxDbGridSelColCaption; Caption:=sRxDbGridSelColCaption;
SpeedButton1.Hint:=sRxDbGridSelColHint1; sbUp.Hint:=sRxDbGridSelColHint1;
SpeedButton2.Hint:=sRxDbGridSelColHint2; sbDown.Hint:=sRxDbGridSelColHint2;
btnApply.Caption:=sRxDbGridSelApplyCaption;
btnApply.Hint:=sRxDbGridSelApplyHint;
end; end;
procedure TrxDBGridColumsForm.SpeedButton1Click(Sender: TObject); procedure TrxDBGridColumsForm.btnApplyClick(Sender: TObject);
var
S:string;
i:integer;
begin begin
if (CheckListBox1.Items.Count > 1) and (CheckListBox1.ItemIndex>-1) then SetGridColumnsParams;
end;
procedure TrxDBGridColumsForm.sbUpClick(Sender: TObject);
var
S, W, C:string;
begin
if (StringGrid1.RowCount > 1) and (StringGrid1.Row > 1) then
begin begin
if CheckListBox1.ItemIndex>0 then C:=StringGrid1.Cells[0, StringGrid1.Row-1];
begin S:=StringGrid1.Cells[1, StringGrid1.Row-1];
i:=CheckListBox1.ItemIndex-1; W:=StringGrid1.Cells[2, StringGrid1.Row-1];
S:=CheckListBox1.Items[CheckListBox1.ItemIndex];
CheckListBox1.Items[CheckListBox1.ItemIndex]:=CheckListBox1.Items[i]; StringGrid1.Cells[0, StringGrid1.Row-1]:=StringGrid1.Cells[0, StringGrid1.Row];
CheckListBox1.Items[i]:=S; StringGrid1.Cells[1, StringGrid1.Row-1]:=StringGrid1.Cells[1, StringGrid1.Row];
CheckListBox1.ItemIndex:=i; StringGrid1.Cells[2, StringGrid1.Row-1]:=StringGrid1.Cells[2, StringGrid1.Row];
end;
StringGrid1.Cells[0, StringGrid1.Row]:=C;
StringGrid1.Cells[1, StringGrid1.Row]:=S;
StringGrid1.Cells[2, StringGrid1.Row]:=W;
StringGrid1.Row:=StringGrid1.Row-1;
end; end;
end; end;
procedure TrxDBGridColumsForm.SpeedButton2Click(Sender: TObject); procedure TrxDBGridColumsForm.sbDownClick(Sender: TObject);
var var
S:string; S, W, C:string;
i:integer; i:integer;
begin begin
if (CheckListBox1.Items.Count > 1) and (CheckListBox1.ItemIndex>-1) then if (StringGrid1.RowCount > 1) and (StringGrid1.Row < StringGrid1.RowCount - 1) then
begin begin
if CheckListBox1.ItemIndex<CheckListBox1.Items.Count-1 then C:=StringGrid1.Cells[0, StringGrid1.Row+1];
begin S:=StringGrid1.Cells[1, StringGrid1.Row+1];
i:=CheckListBox1.ItemIndex+1; W:=StringGrid1.Cells[2, StringGrid1.Row+1];
S:=CheckListBox1.Items[CheckListBox1.ItemIndex];
CheckListBox1.Items[CheckListBox1.ItemIndex]:=CheckListBox1.Items[i]; StringGrid1.Cells[0, StringGrid1.Row+1]:=StringGrid1.Cells[0, StringGrid1.Row];
CheckListBox1.Items[i]:=S; StringGrid1.Cells[1, StringGrid1.Row+1]:=StringGrid1.Cells[1, StringGrid1.Row];
CheckListBox1.ItemIndex:=i; StringGrid1.Cells[2, StringGrid1.Row+1]:=StringGrid1.Cells[2, StringGrid1.Row];
end;
StringGrid1.Cells[0, StringGrid1.Row]:=C;
StringGrid1.Cells[1, StringGrid1.Row]:=S;
StringGrid1.Cells[2, StringGrid1.Row]:=W;
StringGrid1.Row:=StringGrid1.Row+1;
end; end;
end; end;
procedure TrxDBGridColumsForm.StringGrid1ValidateEntry(sender: TObject; aCol,
aRow: Integer; const OldValue: string; var NewValue: String);
begin
if aCol = 2 then
NewValue:=IntToStr(Max(StrToIntDef(NewValue, StrToIntDef(OldValue, 0)), 0));
end;
procedure TrxDBGridColumsForm.SetGrid(AGrid: TRxDBGrid); procedure TrxDBGridColumsForm.SetGrid(AGrid: TRxDBGrid);
var var
i:integer; i:integer;
begin begin
if AGrid=FGrid then exit; if AGrid=FGrid then exit;
FGrid:=AGrid; FGrid:=AGrid;
CheckListBox1.Items.Clear;
if Assigned(AGrid) then if Assigned(AGrid) then
begin begin
StringGrid1.RowCount:=AGrid.Columns.Count+1;
for i:=0 to AGrid.Columns.Count-1 do for i:=0 to AGrid.Columns.Count-1 do
begin begin
CheckListBox1.Items.Add(AGrid.Columns[i].Title.Caption); StringGrid1.Cells[0, i+1]:=BoolToStr(AGrid.Columns[i].Visible, '1', '0');
CheckListBox1.Checked[i]:=AGrid.Columns[i].Visible; StringGrid1.Cells[1, i+1]:=AGrid.Columns[i].Title.Caption;
end; StringGrid1.Cells[2, i+1]:=IntToStr(AGrid.Columns[i].Width);
end; end;
end
else
StringGrid1.RowCount:=1;
end; end;
procedure TrxDBGridColumsForm.SetGridColumnsParams; procedure TrxDBGridColumsForm.SetGridColumnsParams;
@ -151,13 +191,14 @@ var
i:integer; i:integer;
Col:TRxColumn; Col:TRxColumn;
begin begin
for i:=0 to CheckListBox1.Items.Count-1 do for i:=1 to StringGrid1.RowCount-1 do
begin begin
Col:=FGrid.ColumnByCaption(CheckListBox1.Items[i]); Col:=FGrid.ColumnByCaption(StringGrid1.Cells[1, i]);
if Assigned(Col) then if Assigned(Col) then
begin begin
Col.Visible:=CheckListBox1.Checked[i]; Col.Visible:=StringGrid1.Cells[0, i] = '1';
Col.Index:=i; Col.Index:=i-1;
Col.Width:=StrToIntDef(StringGrid1.Cells[2, i], 65);
end end
end; end;
end; end;

View File

@ -10,16 +10,16 @@ object rxDBGridFindForm: TrxDBGridFindForm
OnCreate = FormCreate OnCreate = FormCreate
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.1' LCLVersion = '1.3'
object Label1: TLabel object Label1: TLabel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
AnchorSideBottom.Control = Edit1 AnchorSideBottom.Control = Edit1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 6 Left = 6
Height = 15 Height = 21
Top = 6 Top = 6
Width = 69 Width = 75
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Text to find' Caption = 'Text to find'
FocusControl = Edit1 FocusControl = Edit1
@ -32,9 +32,9 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideBottom.Control = ComboBox1 AnchorSideBottom.Control = ComboBox1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 6 Left = 6
Height = 15 Height = 21
Top = 58 Top = 70
Width = 73 Width = 75
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Find at filed' Caption = 'Find at filed'
ParentColor = False ParentColor = False
@ -43,10 +43,10 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideRight.Control = Button2 AnchorSideRight.Control = Button2
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 347 Left = 340
Height = 33 Height = 41
Top = 186 Top = 178
Width = 81 Width = 84
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -63,10 +63,10 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 434 Left = 430
Height = 33 Height = 41
Top = 186 Top = 178
Width = 53 Width = 57
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 8 BorderSpacing.Top = 8
@ -84,8 +84,8 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 18 Left = 18
Height = 25 Height = 31
Top = 27 Top = 33
Width = 469 Width = 469
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -98,8 +98,8 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 12 Left = 12
Height = 27 Height = 33
Top = 79 Top = 97
Width = 475 Width = 475
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -116,10 +116,10 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Panel1 AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 146 Left = 147
Height = 62 Height = 66
Top = 112 Top = 136
Width = 341 Width = 340
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True AutoFill = True
AutoSize = True AutoSize = True
@ -135,8 +135,8 @@ object rxDBGridFindForm: TrxDBGridFindForm
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 3 ChildSizing.ControlsPerLine = 3
ClientHeight = 45 ClientHeight = 43
ClientWidth = 337 ClientWidth = 336
Columns = 3 Columns = 3
Items.Strings = ( Items.Strings = (
'All' 'All'
@ -150,22 +150,22 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideTop.Control = ComboBox1 AnchorSideTop.Control = ComboBox1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 62 Height = 66
Top = 112 Top = 136
Width = 134 Width = 135
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ClientHeight = 62 ClientHeight = 66
ClientWidth = 134 ClientWidth = 135
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 = 21 Height = 23
Top = 34 Top = 36
Width = 88 Width = 91
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Partial key' Caption = 'Partial key'
TabOrder = 0 TabOrder = 0
@ -174,9 +174,9 @@ object rxDBGridFindForm: TrxDBGridFindForm
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1 AnchorSideTop.Control = Panel1
Left = 7 Left = 7
Height = 21 Height = 23
Top = 7 Top = 7
Width = 120 Width = 121
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Case sensetive' Caption = 'Case sensetive'
TabOrder = 1 TabOrder = 1

View File

@ -121,6 +121,7 @@ var
P:TBookMark; P:TBookMark;
R:boolean; R:boolean;
begin begin
{ TODO -oalexs : Необходимо переделать поиск по колонке - искать всегда по строковому представлению. Иначе не ищет по дате-времени }
if Edit1.Text<>'' then if Edit1.Text<>'' then
begin begin
try try

View File

@ -161,6 +161,8 @@ resourcestring
sRxDbGridSelColCaption = 'Grid columns'; sRxDbGridSelColCaption = 'Grid columns';
sRxDbGridSelColHint1 = 'Move selected column up'; sRxDbGridSelColHint1 = 'Move selected column up';
sRxDbGridSelColHint2 = 'Move selected column down'; sRxDbGridSelColHint2 = 'Move selected column down';
sRxDbGridSelApplyCaption = 'Apply';
sRxDbGridSelApplyHint = 'Apply current columns setings';
//seldsfrm //seldsfrm
sRxBorrowStructure = 'Borrow structure...'; sRxBorrowStructure = 'Borrow structure...';