[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'Calendar' (#lcl)

# TCustomCalendar

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements the base class for TCalendar.

## Declaration

Source position: calendar.pp line 78

`type TCustomCalendar = class(TWinControl)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure LMChanged(); message;` |  | Handles the LCL LM_CHANGED message received when the calendar control is updated.
`procedure LMMonthChanged(); message;` |  | Handles the LCL LM_MONTHCHANGED message received when the month has been changed using the calendar control.
`procedure LMYearChanged(); message;` |  | Handles the LCL LM_YEARCHANGED message received when the year number has been changed on the calendar control.
`procedure LMDayChanged(); message;` |  | Handles the LCL LM_DAYCHANGED message received when the day number has been changed on the calendar control.
`class function GetControlClassDefaultSize; override;` |  | Gets the default dimensions for a new instance of the control.
`procedure Loaded; override;` |  | Performs actions when the component has finished loading during LCL component streaming.
`procedure InitializeWnd; override;` |  | Copies cached control properties to the newly created widget.
`procedure DestroyWnd; override;` |  | Destroys the interface object (widget).
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`function HitTest();` |  | Indicates where a mouse click occurred in the calendar control.
`function GetCalendarView;` |  | Gets the current view for the Calendar.
`property Date: string; [rws]` |  | String representation for the date value on the calendar control.
`property DateTime: TDateTime; [rw]` |  | Native data type used for a date value on the calendar control.
`property DisplaySettings: TDisplaySettings; [rw]` |  | DisplaySettings contains options which control the appearance or behavior for the calendar control.
`property FirstDayOfWeek: TCalDayOfWeek; [rw]` |  | Indicates the day of the week displayed as the first column in the calendar grid.
`property MaxDate: TDateTime; [rws]` |  | Largest date value that can entered or selected using the calendar control.
`property MinDate: TDateTime; [rws]` |  | Smallest date value that can entered or selected using the calendar control.
`property OnChange: TNotifyEvent; [rw]` |  | Event handler signalled when the calendar control has been changed.
`property OnDayChanged: TNotifyEvent; [rw]` |  | Event handler signalled when the day number in DateTime has been changed using the calendar control.
`property OnMonthChanged: TNotifyEvent; [rw]` |  | Event handler signalled when the month number in DateTime has been changed using the calendar control.
`property OnYearChanged: TNotifyEvent; [rw]` |  | Event handler signalled when the year number in DateTime has been changed using the calendar control.
`end;`

## Inheritance

`TCustomCalendar` |  | Implements the base class for TCalendar.
`TWinControl` |  | Implements a windowed control which can contain other child controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TCustomCalendar is the base class for TCalendar, a graphic control used to select a date value from the familiar monthly calendar layout. It includes Date and DateTime properties with the selected date as a String or a TDateTime value.

TCustomCalendar acts as a wrapper for the native calendar control on a given platform. The range of dates allowed in a native calendar control varies by platform. Starting in LCL version 3.0, TCustomCalendar includes MinDate and MaxDate properties which can used to limit the dates displayed on the calendar to a specified minimum and maximum date. Setting Date or DateTime to a value outside the allowed range (when used) causes an EInvalidDate exception to be raised.

Please note that MinDate and MaxDate are not supported on all platforms; they are not implemented for GTK2 and GTK3 because the native calendar control does not implement or enforce them.

DisplaySettings can be used to control the visual layout and behavior for the calendar. This includes the first day of the week for the calendar layout as well as use of headings, days names, and week numbers.

Use the OnChange, OnDayChanged, OnMonthChanged, and OnYearChanged event handlers to perform actions needed when the date or its component values have been modified on the calendar control.

Changes made to properties in the control are applied to the widgetset class instance (the native calendar control) when its handle has been allocated.

## See also

TCalendar |  | TCalendar allows selection of a date from a calendar display.
TWinControl |  | Implements a windowed control which can contain other child controls.