Using the TCalendar, it has a option on top of calendar for previous month , next month buttons. Then it has a dropdown for month and a drop down for year. I cant seem to find out how to get this data when it changes.
Month := Calendar1.???
Year := calendar1.???
Also how to know when the previous, next, month dropdown and year dropdown is selected? On change
?
To be clear, I can get month and year from selected date. The question is if they change month and year but don't select day. Then date has not changed so I can't use date to get the current month and year that is in view on the calendar
For example, to output the new date to a memo:
Memo1.Lines.Add(DateToStr(Calendar1.Date));
To output to the memo day, month and/or year, add System.DateUtils
to uses
and write code like:
Memo1.Lines.Add(IntToStr(DayOf( Calendar1.Date)));
Memo1.Lines.Add(IntToStr(MonthOf( Calendar1.Date)));
Memo1.Lines.Add(IntToStr(YearOf( Calendar1.Date)));
The OnChange
event is the one that gets triggered whenever the date of the calendar is changed.