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

# TCalendar

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

TCalendar allows selection of a date from a calendar display.

## Declaration

Source position: calendar.pp line 138

`type TCalendar = class(TCustomCalendar)`
`published`
`property Align: TAlign;` |  | Specifies the placement of the control on its Parent control.
`property Anchors: TAnchors;` |  | The set of anchor definitions for this control.
`property AutoSize: Boolean;` |  | Allows automatic adjustment of the size for the control, according to its content.
`property BorderSpacing: TControlBorderSpacing;` |  | Determines the inner and outer border spacing for this control.
`property Constraints: TSizeConstraints;` |  | Contains the minimum and maximum Width and Height for the control.
`property DateTime: TDateTime;` |  | Native data type used for a date value on the calendar control.
`property DisplaySettings: TDisplaySettings;` |  | DisplaySettings contains options which control the appearance or behavior for the calendar control.
`property DoubleBuffered: Boolean;` |  | When enabled, it reduces flicker when the control is painted.
`property FirstDayOfWeek: TCalDayOfWeek;` |  | Indicates the day of the week displayed as the first column in the calendar grid.
`property Hint: TTranslateString;` |  | The text to show in the Hint window for the control.
`property MinDate: TDateTime;` |  | Smallest date value that can entered or selected using the calendar control.
`property MaxDate: TDateTime;` |  | Largest date value that can entered or selected using the calendar control.
`property ParentDoubleBuffered: Boolean;` |  | Value for the DoubleBuffered property in a Parent control.
`property PopupMenu: TPopupMenu;` |  | A context-sensitive menu that pops up when the right mouse button is clicked over this control.
`property ShowHint: Boolean;` |  | Enables Hint display for the control.
`property TabOrder: TTabOrder;` |  | Indicates the navigation order for the control when the user presses the Tab or Shift+Tab key.
`property TabStop: Boolean;` |  | Allows the user to navigate to / from the control by pressing the Tab or Shift+Tab keys.
`property Visible: Boolean;` |  | Allows the control, and all of its children, to be displayed or hidden.
`property OnChange: TNotifyEvent;` |  | Event handler signalled when the calendar control has been changed.
`property OnChangeBounds: TNotifyEvent;` |  | Event handler signalled when the Bounds for the control have been changed.
`property OnClick: TNotifyEvent;` |  | Notification handler for mouse clicks.
`property OnDayChanged: TNotifyEvent;` |  | Event handler signalled when the day number in DateTime has been changed using the calendar control.
`property OnDblClick: TNotifyEvent;` |  | Event handler signalled when a mouse double click occurs in the control.
`property OnEnter: TNotifyEvent;` |  | Event handler signalled when the control receives focus.
`property OnExit: TNotifyEvent;` |  | Event handler signalled when the control loses focus.
`property OnKeyDown: TKeyEvent;` |  | Event handler signalled for key down keyboard events.
`property OnKeyPress: TKeyPressEvent;` |  | Event handler signalled for character data entered by the user.
`property OnKeyUp: TKeyEvent;` |  | Event handler signalled when a key up event has occurred for the control.
`property OnMonthChanged: TNotifyEvent;` |  | Event handler signalled when the month number in DateTime has been changed using the calendar control.
`property OnMouseDown: TMouseEvent;` |  | Event handler signalled when a mouse down event is handled for the control.
`property OnMouseEnter: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has entered the control.
`property OnMouseLeave: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has left the control.
`property OnMouseMove: TMouseMoveEvent;` |  | Event handler signalled when the mouse pointer is moved in the control.
`property OnMouseUp: TMouseEvent;` |  | Event handler signalled when a mouse up event is handled for the control.
`property OnMouseWheel: TMouseWheelEvent;` |  | Event handler for mouse wheel turned.
`property OnMouseWheelDown: TMouseWheelUpDownEvent;` |  | Event handler signalled for a downward movement of the mouse wheel.
`property OnMouseWheelUp: TMouseWheelUpDownEvent;` |  | Event handler signalled for an upward movement of the mouse wheel.
`property OnMouseWheelHorz: TMouseWheelEvent;` |  | Event handler signalled for a horizontal movement of the mouse wheel.
`property OnMouseWheelLeft: TMouseWheelUpDownEvent;` |  | Event handler signalled for a leftward movement of the mouse wheel.
`property OnMouseWheelRight: TMouseWheelUpDownEvent;` |  | Event handler signalled for a rightward movement of the mouse wheel.
`property OnResize: TNotifyEvent;` |  | Notification handler for a resize of the control.
`property OnUTF8KeyPress: TUTF8KeyPressEvent;` |  | Handler for a character entered by the user.
`property OnYearChanged: TNotifyEvent;` |  | Event handler signalled when the year number in DateTime has been changed using the calendar control.
`end;`

## Inheritance

`TCalendar` |  | TCalendar allows selection of a date from a calendar display.
`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

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

TCalendar / TCustomCalendar act 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

TCustomCalendar |  | Implements the base class for TCalendar.