diff --git a/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi b/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi index 77ba9b31b..48f6b7f52 100644 --- a/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi +++ b/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi @@ -54,7 +54,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -75,7 +75,7 @@ - + @@ -102,12 +102,11 @@ - - - - + + + @@ -193,18 +192,23 @@ - - - + + + + + + + + - + - - - + + + @@ -503,21 +507,21 @@ - + - + - + - - - + + + @@ -801,169 +805,165 @@ - - - - - - - - + - - + + - - + + - - - - - - - - - - + + + - + + + + + + + + + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/components/rx/trunk/folderlister.pas b/components/rx/trunk/folderlister.pas index cbb58ce13..6ded80f4e 100644 --- a/components/rx/trunk/folderlister.pas +++ b/components/rx/trunk/folderlister.pas @@ -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; diff --git a/components/rx/trunk/languages/rxdconst.es.po b/components/rx/trunk/languages/rxdconst.es.po index 02355667e..e297b7b49 100644 --- a/components/rx/trunk/languages/rxdconst.es.po +++ b/components/rx/trunk/languages/rxdconst.es.po @@ -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" diff --git a/components/rx/trunk/languages/rxdconst.po b/components/rx/trunk/languages/rxdconst.po index d1d1df4f9..b21287f86 100644 --- a/components/rx/trunk/languages/rxdconst.po +++ b/components/rx/trunk/languages/rxdconst.po @@ -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 "" diff --git a/components/rx/trunk/languages/rxdconst.ru.po b/components/rx/trunk/languages/rxdconst.ru.po index bfe3c79db..a530817cd 100644 --- a/components/rx/trunk/languages/rxdconst.ru.po +++ b/components/rx/trunk/languages/rxdconst.ru.po @@ -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 "Применить" diff --git a/components/rx/trunk/languages/rxdconst.uk.po b/components/rx/trunk/languages/rxdconst.uk.po index 9f1dd6381..ffc9a5b7c 100644 --- a/components/rx/trunk/languages/rxdconst.uk.po +++ b/components/rx/trunk/languages/rxdconst.uk.po @@ -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 "Застосувати" diff --git a/components/rx/trunk/rxdbgrid.pas b/components/rx/trunk/rxdbgrid.pas index 1bb6b4d49..627a7d663 100644 --- a/components/rx/trunk/rxdbgrid.pas +++ b/components/rx/trunk/rxdbgrid.pas @@ -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 diff --git a/components/rx/trunk/rxdbgrid_columsunit.lfm b/components/rx/trunk/rxdbgrid_columsunit.lfm index 1658f8098..075f1b9aa 100644 --- a/components/rx/trunk/rxdbgrid_columsunit.lfm +++ b/components/rx/trunk/rxdbgrid_columsunit.lfm @@ -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 diff --git a/components/rx/trunk/rxdbgrid_columsunit.pas b/components/rx/trunk/rxdbgrid_columsunit.pas index 5a6e3a169..365bf51b2 100644 --- a/components/rx/trunk/rxdbgrid_columsunit.pas +++ b/components/rx/trunk/rxdbgrid_columsunit.pas @@ -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'' then begin try diff --git a/components/rx/trunk/rxdconst.pas b/components/rx/trunk/rxdconst.pas index 2a1bb0922..7a813f4c0 100644 --- a/components/rx/trunk/rxdconst.pas +++ b/components/rx/trunk/rxdconst.pas @@ -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...';