diff --git a/components/rx/trunk/demos/RxDateEdit/project1.lpi b/components/rx/trunk/demos/RxDateEdit/project1.lpi index 5e195e080..2011f50ad 100644 --- a/components/rx/trunk/demos/RxDateEdit/project1.lpi +++ b/components/rx/trunk/demos/RxDateEdit/project1.lpi @@ -1,7 +1,7 @@ - + @@ -27,25 +27,28 @@ - + - - + - - + + - + + + + + - + - + @@ -55,8 +58,9 @@ - - + + + @@ -197,88 +201,137 @@ + + + + + + + + + - + - + - + - + - + - + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/rx/trunk/demos/RxDateEdit/project1.lpr b/components/rx/trunk/demos/RxDateEdit/project1.lpr index 718a85524..c0bf3e673 100644 --- a/components/rx/trunk/demos/RxDateEdit/project1.lpr +++ b/components/rx/trunk/demos/RxDateEdit/project1.lpr @@ -7,7 +7,7 @@ uses cthreads, {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset - Forms, + Forms, lazcontrols, Unit1, sysutils { you can add units after this }; diff --git a/components/rx/trunk/demos/RxDateEdit/unit1.lfm b/components/rx/trunk/demos/RxDateEdit/unit1.lfm index ec07674a3..d8e5e8f35 100644 --- a/components/rx/trunk/demos/RxDateEdit/unit1.lfm +++ b/components/rx/trunk/demos/RxDateEdit/unit1.lfm @@ -1,99 +1,241 @@ object Form1: TForm1 - Left = 608 - Height = 300 - Top = 495 - Width = 400 + Left = 502 + Height = 397 + Top = 390 + Width = 590 Caption = 'Form1' - ClientHeight = 300 - ClientWidth = 400 + ClientHeight = 397 + ClientWidth = 590 OnCreate = FormCreate - LCLVersion = '1.7' - object Label1: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Owner - Left = 6 - Height = 20 - Top = 6 - Width = 42 - BorderSpacing.Left = 6 - BorderSpacing.Top = 6 - Caption = 'Label1' - ParentColor = False - end - object Label2: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = RxDBDateEdit1 - AnchorSideTop.Side = asrBottom - Left = 6 - Height = 20 - Top = 75 - Width = 87 - BorderSpacing.Around = 6 - Caption = 'Currency edit' - ParentColor = False - end - object CurrencyEdit1: TCurrencyEdit - AnchorSideLeft.Control = Label2 - AnchorSideTop.Control = Label2 - AnchorSideTop.Side = asrBottom - Left = 12 - Height = 37 - Top = 101 - Width = 148 - Alignment = taCenter - BorderSpacing.Around = 6 - MaxValue = 0 - MinValue = 0 + LCLVersion = '1.9.0.0' + object PageControl1: TPageControl + Left = 0 + Height = 397 + Top = 0 + Width = 590 + ActivePage = TabSheet2 + Align = alClient + TabIndex = 1 TabOrder = 0 - Value = 0 - end - object Button1: TButton - Left = 248 - Height = 36 - Top = 80 - Width = 77 - AutoSize = True - Caption = 'Invalidate' - OnClick = Button1Click - TabOrder = 1 - end - object RxDateEdit1: TRxDateEdit - Left = 12 - Height = 37 - Top = 160 - Width = 80 - ButtonWidth = 23 - MaxLength = 10 - NumGlyphs = 2 - PasswordChar = #0 - PopupColor = clWindow - TabOrder = 2 - Text = ' . . ' - end - object RxDBDateEdit1: TRxDBDateEdit - AnchorSideLeft.Control = Label1 - AnchorSideTop.Control = Label1 - AnchorSideTop.Side = asrBottom - Left = 12 - Height = 37 - Top = 32 - Width = 151 - BorderSpacing.Around = 6 - ButtonWidth = 23 - Enabled = False - MaxLength = 10 - NumGlyphs = 2 - PasswordChar = #0 - PopupColor = clWindow - TabOrder = 3 - Text = 't1. . ' - DataField = 'DOC_DATE' - DataSource = dsData + object TabSheet1: TTabSheet + Caption = 'RxDBDateEdit demo' + ClientHeight = 363 + ClientWidth = 580 + object Label1: TLabel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Owner + Left = 6 + Height = 20 + Top = 6 + Width = 42 + Caption = 'Label1' + ParentColor = False + end + object RxDBDateEdit1: TRxDBDateEdit + AnchorSideLeft.Control = Label1 + AnchorSideTop.Control = Label1 + AnchorSideTop.Side = asrBottom + Left = 12 + Height = 37 + Top = 32 + Width = 151 + BorderSpacing.Around = 6 + ButtonWidth = 23 + Enabled = False + MaxLength = 10 + NumGlyphs = 2 + PasswordChar = #0 + PopupColor = clWindow + TabOrder = 0 + Text = 't1. . ' + DataField = 'DOC_DATE' + DataSource = dsData + end + object Label2: TLabel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = RxDBDateEdit1 + AnchorSideTop.Side = asrBottom + Left = 6 + Height = 20 + Top = 75 + Width = 85 + BorderSpacing.Around = 6 + Caption = 'Currency edit' + ParentColor = False + end + object CurrencyEdit1: TCurrencyEdit + AnchorSideLeft.Control = Label2 + AnchorSideTop.Control = Label2 + AnchorSideTop.Side = asrBottom + Left = 12 + Height = 37 + Top = 101 + Width = 148 + Alignment = taCenter + BorderSpacing.Around = 6 + MaxValue = 0 + MinValue = 0 + TabOrder = 1 + Value = 0 + end + object RxDateEdit1: TRxDateEdit + Left = 12 + Height = 37 + Top = 160 + Width = 80 + ButtonWidth = 23 + MaxLength = 10 + NumGlyphs = 2 + PasswordChar = #0 + PopupColor = clWindow + TabOrder = 2 + Text = ' . . ' + end + object Button1: TButton + Left = 248 + Height = 36 + Top = 80 + Width = 77 + AutoSize = True + Caption = 'Invalidate' + OnClick = Button1Click + TabOrder = 3 + end + end + object TabSheet2: TTabSheet + Caption = 'RxDateRangeEdit demo' + ClientHeight = 363 + ClientWidth = 580 + object CheckBox1: TCheckBox + AnchorSideLeft.Control = TabSheet2 + AnchorSideTop.Control = TabSheet2 + Left = 6 + Height = 24 + Top = 6 + Width = 88 + BorderSpacing.Around = 6 + Caption = 'reoMonth' + Checked = True + OnChange = CheckBox1Change + State = cbChecked + TabOrder = 0 + end + object RxDateRangeEdit1: TRxDateRangeEdit + AnchorSideLeft.Control = TabSheet2 + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = CheckBox3 + AnchorSideTop.Side = asrBottom + Left = 159 + Height = 37 + Top = 96 + Width = 262 + BorderSpacing.Around = 6 + Month = 5 + TabOrder = 1 + Year = 2017 + OnChange = RxDateRangeEdit1Change + end + object CheckBox2: TCheckBox + AnchorSideLeft.Control = TabSheet2 + AnchorSideTop.Control = CheckBox1 + AnchorSideTop.Side = asrBottom + Left = 6 + Height = 24 + Top = 36 + Width = 96 + BorderSpacing.Around = 6 + Caption = 'reoQuarter' + Checked = True + OnChange = CheckBox1Change + State = cbChecked + TabOrder = 2 + end + object CheckBox3: TCheckBox + AnchorSideLeft.Control = TabSheet2 + AnchorSideTop.Control = CheckBox2 + AnchorSideTop.Side = asrBottom + Left = 6 + Height = 24 + Top = 66 + Width = 102 + BorderSpacing.Around = 6 + Caption = 'reoHalfYear' + Checked = True + OnChange = CheckBox1Change + State = cbChecked + TabOrder = 3 + end + object Label3: TLabel + AnchorSideLeft.Control = TabSheet2 + AnchorSideTop.Control = RxDateRangeEdit1 + AnchorSideTop.Side = asrBottom + Left = 6 + Height = 20 + Top = 139 + Width = 92 + BorderSpacing.Around = 6 + Caption = 'Start of period' + ParentColor = False + end + object Edit1: TEdit + AnchorSideLeft.Control = Label3 + AnchorSideTop.Control = Label3 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Label5 + Left = 12 + Height = 37 + Top = 165 + Width = 272 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 6 + ReadOnly = True + TabOrder = 4 + Text = 'Edit1' + end + object Label4: TLabel + AnchorSideLeft.Control = Label5 + AnchorSideTop.Control = RxDateRangeEdit1 + AnchorSideTop.Side = asrBottom + Left = 296 + Height = 20 + Top = 139 + Width = 85 + BorderSpacing.Around = 6 + Caption = 'End of period' + ParentColor = False + end + object Edit2: TEdit + AnchorSideLeft.Control = Label4 + AnchorSideTop.Control = Label4 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = TabSheet2 + AnchorSideRight.Side = asrBottom + Left = 302 + Height = 37 + Top = 165 + Width = 272 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 6 + ReadOnly = True + TabOrder = 5 + Text = 'Edit2' + end + object Label5: TLabel + AnchorSideLeft.Control = TabSheet2 + AnchorSideLeft.Side = asrCenter + AnchorSideTop.Control = TabSheet2 + Left = 290 + Height = 1 + Top = 0 + Width = 1 + ParentColor = False + end + end end object dsData: TDataSource DataSet = rxData - left = 264 - top = 21 + Left = 264 + Top = 21 end object rxData: TRxMemoryData FieldDefs = < @@ -102,8 +244,8 @@ object Form1: TForm1 DataType = ftDate end> PacketRecords = 0 - left = 304 - top = 21 + Left = 304 + Top = 21 object rxDataDOC_DATE: TDateField DisplayWidth = 10 FieldKind = fkData diff --git a/components/rx/trunk/demos/RxDateEdit/unit1.pas b/components/rx/trunk/demos/RxDateEdit/unit1.pas index 6a81cd688..04e4933ed 100644 --- a/components/rx/trunk/demos/RxDateEdit/unit1.pas +++ b/components/rx/trunk/demos/RxDateEdit/unit1.pas @@ -5,8 +5,9 @@ unit Unit1; interface uses - Classes, SysUtils, db, FileUtil, LResources, Forms, Controls, Graphics, - Dialogs, StdCtrls, rxmemds, rxdbdateedit, rxcurredit, rxtooledit; + Classes, SysUtils, db, FileUtil, DividerBevel, LResources, Forms, Controls, + Graphics, Dialogs, StdCtrls, ComCtrls, rxmemds, rxdbdateedit, rxcurredit, + rxtooledit, rxDateRangeEditUnit; type @@ -14,16 +15,30 @@ type TForm1 = class(TForm) Button1: TButton; + CheckBox1: TCheckBox; + CheckBox2: TCheckBox; + CheckBox3: TCheckBox; CurrencyEdit1: TCurrencyEdit; dsData: TDatasource; + Edit1: TEdit; + Edit2: TEdit; Label1: TLabel; Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + PageControl1: TPageControl; rxData: TRxMemoryData; rxDataDOC_DATE: TDateField; RxDateEdit1: TRxDateEdit; + RxDateRangeEdit1: TRxDateRangeEdit; RxDBDateEdit1: TRxDBDateEdit; + TabSheet1: TTabSheet; + TabSheet2: TTabSheet; procedure Button1Click(Sender: TObject); + procedure CheckBox1Change(Sender: TObject); procedure FormCreate(Sender: TObject); + procedure RxDateRangeEdit1Change(Sender: TObject); private { private declarations } public @@ -44,7 +59,15 @@ begin rxData.Open; rxData.Append; rxDataDOC_DATE.AsDateTime:=Now; - CurrencyEdit1.Value:=1214.55 + CurrencyEdit1.Value:=1214.55; + + CheckBox1Change(nil); +end; + +procedure TForm1.RxDateRangeEdit1Change(Sender: TObject); +begin + Edit1.Text:=DateToStr(RxDateRangeEdit1.Period); + Edit2.Text:=DateToStr(RxDateRangeEdit1.PeriodEnd); end; procedure TForm1.Button1Click(Sender: TObject); @@ -52,5 +75,19 @@ begin CurrencyEdit1.Invalidate; end; +procedure TForm1.CheckBox1Change(Sender: TObject); +var + R: TRxDateRangeEditOptions; +begin + R:=[]; + if CheckBox1.Checked then + R:=R + [reoMonth]; + if CheckBox2.Checked then + R:=R + [reoQuarter]; + if CheckBox3.Checked then + R:=R + [reoHalfYear]; + RxDateRangeEdit1.Options:=R; +end; + end. diff --git a/components/rx/trunk/demos/rxdbgrid/WordWrap/WordWrapDemo.lps b/components/rx/trunk/demos/rxdbgrid/WordWrap/WordWrapDemo.lps index 46f8640f3..fa0e270bd 100644 --- a/components/rx/trunk/demos/rxdbgrid/WordWrap/WordWrapDemo.lps +++ b/components/rx/trunk/demos/rxdbgrid/WordWrap/WordWrapDemo.lps @@ -30,8 +30,8 @@ - - + + @@ -44,7 +44,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -97,15 +97,14 @@ - - - + + + - - + @@ -115,123 +114,123 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/components/rx/trunk/rxcontrols/rxdaterangeeditunit.pas b/components/rx/trunk/rxcontrols/rxdaterangeeditunit.pas index 1d8b72c08..1ab10eee5 100644 --- a/components/rx/trunk/rxcontrols/rxdaterangeeditunit.pas +++ b/components/rx/trunk/rxcontrols/rxdaterangeeditunit.pas @@ -276,13 +276,40 @@ begin end; function TRxCustomDateRangeEdit.GetPeriod: TDateTime; +var + i: PtrInt; + M: Word; begin - Result:=EncodeDate(Year, Month, 1); + i:=PtrInt(FEditMonth.Items.Objects[FEditMonth.ItemIndex]); + + if I < 13 then + M:=Month + else + if i in [13..16] then + M:= (I - 13) * 3 + 1 + else + if i in [17..18] then + M:= (I - 17) * 6 + 1; + + Result:=EncodeDate(Year, M, 1); end; function TRxCustomDateRangeEdit.GetPeriodEnd: TDateTime; +var + i: PtrInt; + M: Integer; begin - Result:=EncodeDate(Year, Month, DaysPerMonth(Year, Month)); + i:=PtrInt(FEditMonth.Items.Objects[FEditMonth.ItemIndex]); + if I < 13 then + M:=Month + else + if i in [13..16] then + M:= (I - 12) * 3 + else + if i in [17..18] then + M:= (I - 16) * 6; + + Result:=EncodeDate(Year, M, DaysPerMonth(Year, M)) end; function TRxCustomDateRangeEdit.GetQuarter: word; @@ -392,37 +419,28 @@ end; procedure TRxCustomDateRangeEdit.FillMonthNames; var - i, k: Integer; + i: Integer; begin FEditMonth.Items.BeginUpdate; FEditMonth.Items.Clear; if (reoMonth in FOptions) or (FOptions = []) then begin for i:=1 to 12 do - begin - k:=FEditMonth.Items.Add(DefaultFormatSettings.LongMonthNames[i]); - FEditMonth.Items.Objects[K]:=TObject(Pointer(i)); - end; + FEditMonth.Items.AddObject(DefaultFormatSettings.LongMonthNames[i], TObject(Pointer(i))); end; if (reoQuarter in FOptions) or (FOptions = []) then begin - k:=FEditMonth.Items.Add(sFirstQuarter); - FEditMonth.Items.Objects[K]:=TObject(Pointer(13)); - k:=FEditMonth.Items.Add(sSecondQuarter); - FEditMonth.Items.Objects[K]:=TObject(Pointer(14)); - k:=FEditMonth.Items.Add(sThirdQuarter); - FEditMonth.Items.Objects[K]:=TObject(Pointer(15)); - k:=FEditMonth.Items.Add(sFourthQuarter); - FEditMonth.Items.Objects[K]:=TObject(Pointer(16)); + FEditMonth.Items.AddObject(sFirstQuarter, TObject(Pointer(13))); + FEditMonth.Items.AddObject(sSecondQuarter, TObject(Pointer(14))); + FEditMonth.Items.AddObject(sThirdQuarter, TObject(Pointer(15))); + FEditMonth.Items.AddObject(sFourthQuarter, TObject(Pointer(16))); end; if (reoHalfYear in FOptions) or (FOptions = []) then begin - k:=FEditMonth.Items.Add(sFirstHalfOfYear); - FEditMonth.Items.Objects[K]:=TObject(Pointer(17)); - k:=FEditMonth.Items.Add(sSecondHalfOfYear); - FEditMonth.Items.Objects[K]:=TObject(Pointer(18)); + FEditMonth.Items.AddObject(sFirstHalfOfYear, TObject(Pointer(17))); + FEditMonth.Items.AddObject(sSecondHalfOfYear, TObject(Pointer(18))); end; FEditMonth.ItemIndex:=0; FEditMonth.Items.EndUpdate;