diff --git a/WhatsNew.txt b/WhatsNew.txt index f775239..c229256 100644 --- a/WhatsNew.txt +++ b/WhatsNew.txt @@ -13,6 +13,7 @@ * [Changed] TToastManager allow multiple instances. * [Tweaked] Add more properties and Assign for TDialogStyleManager * [Tweaked] Add text mode for SVG editor (Thanks for report: keven) + * [Tweaked] TCalendarView.OnOwnerLunarData initialize param (Thanks for report: keven) * [Tweaked] Add Lines to TViewBorderStyle (Thanks for report: 凌风) * [Fixed] Caret of TEditView not move in some cases (Thanks for report: 欢乐飞刀) * [Fixed] MaxWidth of TDialogStyleManager didn't work diff --git a/WhatsNew.zh-CN.txt b/WhatsNew.zh-CN.txt index 13fb688..415e569 100644 --- a/WhatsNew.zh-CN.txt +++ b/WhatsNew.zh-CN.txt @@ -13,6 +13,7 @@ * [更改] TToastManager允许创建多个实例,尤其在非安卓平台,可以让Toast内容显示在你想要的位置 * [优化] TDialogStyleManager增加更多属性,支持Assign * [优化] SVG编辑器增加text模式 (感谢报告:keven) + * [优化] TCalendarView.OnOwnerLunarData中初始化默认参数值 (感谢报告:keven) * [优化] TViewBorderStyle增加Lines,可选多边框 (感谢报告:凌风) * [修正] TEditView某些情况下无法移动光标(感谢报告:欢乐飞刀) * [修正] TDialogStyleManager MaxWidth效果不正确的Bug diff --git a/demos/standard/uFrameDateView.fmx b/demos/standard/uFrameDateView.fmx index 09b51df..27e4261 100644 --- a/demos/standard/uFrameDateView.fmx +++ b/demos/standard/uFrameDateView.fmx @@ -69,11 +69,11 @@ object FrameDateView: TFrameDateView Background.ItemDefault.Color = claGhostwhite Background.ItemDefault.Kind = Solid Gravity = None - Margins.Top = 50.000000000000000000 + Margins.Top = 40.000000000000000000 Size.Width = 344.000000000000000000 Size.Height = 360.000000000000000000 Size.PlatformDefault = False - Position.Y = 100.000000000000000000 + Position.Y = 90.000000000000000000 TabOrder = 1 AutoSize = True Options = [coShowNavigation, coShowWeek, coCalendarWeeks, coTodayHighlight, coShowTodayButton, coShowClearButton, coShowTerm, coShowRowLines, coShowWeekLine] @@ -85,21 +85,31 @@ object FrameDateView: TFrameDateView TextSettingsOfTitle.Font.Size = 15.000000000000000000 TextSettingsOfWeeks.Color = claCadetblue TextSettingsOfWeeks.Font.Size = 13.000000000000000000 + OnClickView = CalendarView1ClickView end object CheckBox1: TCheckBox Position.X = 16.000000000000000000 - Position.Y = 64.000000000000000000 + Position.Y = 60.000000000000000000 TabOrder = 3 Text = #20013#25991 OnChange = CheckBox1Change end object CheckBox2: TCheckBox Position.X = 136.000000000000000000 - Position.Y = 64.000000000000000000 + Position.Y = 60.000000000000000000 TabOrder = 2 Text = #20892#21382 OnChange = CheckBox2Change end + object txtHint: TTextView + Align = Bottom + Size.Width = 344.000000000000000000 + Size.Height = 17.000000000000000000 + Size.PlatformDefault = False + Position.Y = 563.000000000000000000 + TabOrder = 6 + Text = 'txtHint' + end object CalendarLanguage_CN1: TCalendarLanguage_CN Left = 208 Top = 456 diff --git a/demos/standard/uFrameDateView.pas b/demos/standard/uFrameDateView.pas index 48dde38..a0e230e 100644 --- a/demos/standard/uFrameDateView.pas +++ b/demos/standard/uFrameDateView.pas @@ -18,9 +18,11 @@ TFrameDateView = class(TFrame) CheckBox2: TCheckBox; CalendarLanguage_CN1: TCalendarLanguage_CN; GestureManager1: TGestureManager; + txtHint: TTextView; procedure btnBackClick(Sender: TObject); procedure CheckBox1Change(Sender: TObject); procedure CheckBox2Change(Sender: TObject); + procedure CalendarView1ClickView(Sender: TObject; const ID: Integer); private { Private declarations } public @@ -36,6 +38,21 @@ procedure TFrameDateView.btnBackClick(Sender: TObject); Finish; end; +procedure TFrameDateView.CalendarView1ClickView(Sender: TObject; + const ID: Integer); +begin + case ID of + InvaludeDate: txtHint.Text := 'InvaludeDate'; + BID_Up: txtHint.Text := 'Up clicked'; + BID_Next: txtHint.Text := 'Next clicked'; + BID_Today: txtHint.Text := 'Today clicked'; + BID_Navigation: txtHint.Text := 'Navigation clicked'; + BID_Clear: txtHint.Text := 'Clear clicked'; + else + txtHint.Text := FormatDateTime('yyyy-mm-dd', ID); + end; +end; + procedure TFrameDateView.CheckBox1Change(Sender: TObject); begin if CheckBox1.IsChecked then diff --git a/source/UI.Calendar.pas b/source/UI.Calendar.pas index 973362a..697f5f5 100644 --- a/source/UI.Calendar.pas +++ b/source/UI.Calendar.pas @@ -1666,18 +1666,16 @@ function TCalendarViewBase.GetLanguage: ICalendarLanguage; function TCalendarViewBase.GetLunarData(const LDate: Integer; const AState: TCalendarDrawState): TCalendarDateItem; begin - if Assigned(FOnGetLunarData) then begin + if LDate - AState.DrawS < Length(AState.LunarDataList) then + Result := AState.LunarDataList[LDate - AState.DrawS] + else begin Result.Text := ''; Result.IsTerm := False; Result.IsHoliday := False; Result.IsLunarHoliday := False; - FOnGetLunarData(Self, (LDate), Result) - end else begin - if LDate - AState.DrawS < Length(AState.LunarDataList) then - Result := AState.LunarDataList[LDate - AState.DrawS] - else - Result.Text := ''; end; + if Assigned(FOnGetLunarData) then + FOnGetLunarData(Self, (LDate), Result); end; function TCalendarViewBase.GetMonthBegin: TDate;