We want to add a custom text for some days in a TTMSFMXCalendar. The Developers Guide states that this can be done using the OnCustomizeDay event. Unfortunately, the passed date shape object has only a Date and Calendar property and a Paint method. So how do I set a custom text?
Hi
The TTMSFMXCalendar is styleable, and each date contains a text object which can be accessed with the following code:
procedure TForm1.TMSFMXCalendar1CustomizeDay(Sender: TObject; ADate: TDate;
ADayObject: TTMSFMXCalendarDateShape);
var
o: TFmxObject;
dt: TText;
begin
o := ADayObject.FindStyleResource('datetext');
if Assigned(o) and (o is TText) then
begin
dt := o as TText;
dt.Text := 'Hello World !';
end;
end;
Kind Regards,
Pieter