Skip to content

Commit

Permalink
TCalendarView.OnOwnerLunarData initialize param
Browse files Browse the repository at this point in the history
  • Loading branch information
KngStr committed May 24, 2020
1 parent dbed04d commit b310b42
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 11 deletions.
1 change: 1 addition & 0 deletions WhatsNew.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions WhatsNew.zh-CN.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [更改] TToastManager允许创建多个实例,尤其在非安卓平台,可以让Toast内容显示在你想要的位置
* [优化] TDialogStyleManager增加更多属性,支持Assign
* [优化] SVG编辑器增加text模式 (感谢报告:keven)
* [优化] TCalendarView.OnOwnerLunarData中初始化默认参数值 (感谢报告:keven)
* [优化] TViewBorderStyle增加Lines,可选多边框 (感谢报告:凌风)
* [修正] TEditView某些情况下无法移动光标(感谢报告:欢乐飞刀)
* [修正] TDialogStyleManager MaxWidth效果不正确的Bug
Expand Down
18 changes: 14 additions & 4 deletions demos/standard/uFrameDateView.fmx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down
17 changes: 17 additions & 0 deletions demos/standard/uFrameDateView.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 5 additions & 7 deletions source/UI.Calendar.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b310b42

Please sign in to comment.