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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,37 +1,20 @@
object rxDBGridColumsForm: TrxDBGridColumsForm
Left = 489
Height = 375
Height = 505
Top = 248
Width = 448
ActiveControl = CheckListBox1
Width = 481
Caption = 'Grid colums'
ClientHeight = 375
ClientWidth = 448
ClientHeight = 505
ClientWidth = 481
OnCreate = FormCreate
Position = poScreenCenter
ShowHint = True
LCLVersion = '0.9.31'
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
LCLVersion = '1.3'
object ButtonPanel1: TButtonPanel
Left = 6
Height = 42
Top = 327
Width = 436
Height = 41
Top = 458
Width = 469
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
@ -40,16 +23,16 @@ object rxDBGridColumsForm: TrxDBGridColumsForm
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 1
TabOrder = 0
ShowButtons = [pbOK, pbCancel, pbHelp]
object SpeedButton2: TSpeedButton
AnchorSideLeft.Control = SpeedButton1
object sbDown: TSpeedButton
AnchorSideLeft.Control = sbUp
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = SpeedButton1
AnchorSideBottom.Control = SpeedButton1
AnchorSideTop.Control = sbUp
AnchorSideBottom.Control = sbUp
AnchorSideBottom.Side = asrBottom
Left = 143
Height = 34
Left = 516
Height = 33
Top = 0
Width = 23
Anchors = [akTop, akLeft, akBottom]
@ -90,15 +73,15 @@ object rxDBGridColumsForm: TrxDBGridColumsForm
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000
}
NumGlyphs = 0
OnClick = SpeedButton2Click
OnClick = sbDownClick
end
object SpeedButton1: TSpeedButton
object sbUp: TSpeedButton
AnchorSideLeft.Control = ButtonPanel1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ButtonPanel1
AnchorSideBottom.Side = asrBottom
Left = 114
Height = 34
Left = 487
Height = 33
Top = 0
Width = 23
Anchors = [akTop, akLeft, akBottom]
@ -139,8 +122,97 @@ object rxDBGridColumsForm: TrxDBGridColumsForm
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000
}
NumGlyphs = 0
OnClick = SpeedButton1Click
OnClick = sbUpClick
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

View File

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

View File

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

View File

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

View File

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