Classes and types used to implement TCalendar, a graphic control allowing selection of a date from a calendar display.

calendar.pp contains classes and types used to implement TCalendar, a graphic control allowing selection of a date from a calendar display. It is part of the Lazarus Component Library (LCL).

The following components are added to the Lazarus IDE component palette:

Misc Tab

  • TCalendar
Enumerated type with values that control display settings in TCalendar.

TDisplaySetting is an enumerated type with values that control display settings in TCalendar. Values from TDisplaySetting are stored in the TDisplaySettings type.

The value dsStartMonday has been removed in LCL version 2.2 or higher.
Displays a month/year heading. Displays day names. Prevents changing the current month. Displays week numbers. Set type for TDisplaySetting values.

TDisplaySettings is a set type used to store enumerations values from TDisplaySetting. It is the type used for the DisplaySettings property in TCustomCalendar.

Default display settings used in TCalendar.

DefaultDisplaySettings is a constant with the default display settings used in TCalendar. DefaultDisplaySettings contains the following values:

dsShowHeadings
Displays the month/year heading
dsShowDayNames
Displays day names
Indicates where a mouse click occurred in a calendar control.

TCalendarPart is an enumerated type with values that indicate where a mouse click occurred in a calendar control. TCalendarPart is used to implement the TCustomCalendar.HitTest method.

Mouse click cannot be applied to the control; no handle available. Mouse click occurred on a date in the calendar control. Mouse click occurred on a week number in the calendar control. Mouse click occurred on a day heading in the calendar control. Mouse click occurred on a navigation button in a calendar control. Mouse click occurred on the month name heading in the calendar control. Mouse click occurred on the year number heading in the calendar control. Defines the view for a calendar.

TCalendarView is an enumeration type with values that define the view for a calendar control. TCalendarView makes it possible to set the calendar view introduced in Windows Vista or later. In other widgetsets, as well as in older versions of Windows, a calendar has only a standard "month view" grid with days representing a month. TCalendarView is used to implement the TCustomCalendar.GetCalendarView method.

Grid has days for one month. Grid has months in one year. Grid has years from one decade. Grid has decades for one century. Represents days of the week used in TCalendar.

TCalDayOfWeek is an enumerated type with values which represent the day used as the first day of the week in TCustomCalendar and descendants.

Represents Monday. Represents Tuesday. Represents Wednesday. Represents Thursday. Represents Friday. Represents Saturday. Represents Sunday. Use the default day of the week setting for the platform for the first day of the week. Not compatible with the value used in Delphi (dowLocaleDefault). EInvalidDate is an exception raised for an invalid date.

EInvalidDate is an exception raised when a invalid date is selected in a calendar control.

Base class for TCalendar.

TCustomCalendar is the base class for TCalendar, a graphic control for selecting a date.

TWinControl
Gets the value for the DateTime property. Value for the DateTime property. Sets the value for the DateTime property. New value for the DateTime property. Gets values for properties in the calendar control. Sets values for properties in the calendar control. Gets the value for the DisplaySettings property. Value for the DisplaySettings property. Sets the value for the DisplaySettings property. New value for the DisplaySettings property. Gets the value for the Date property. Value for the Date property. Sets the value for the Date property. New value for the Date property. Handles the LCL message received when the control is changed. Message examined in the method. Handles the LCL message received when the month has been changed. Message examined in the method. Handles the LCL message received when the year has been changed. Message examined in the method. Handles the LCL message received when the day has been changed. Message examined in the method. Constructor for the class instance.

Create is the constructor for TCustomCalendar. Create calls the inherited Create method, and sets the style, initial bounds, and display settings for the calendar. Create sets the default date / time value to Now.

TWinControl.Create
Owner of the class instance. Indicates where a mouse click occurred in the calendar control.

HitTest is a TCalendarPart function that indicates where a mouse click occurred in the calendar control. The return value indicates the part of the control clicked, or cpNoWhere when the handle has not been allocated for the control. HitTest ensures that the widget-set specific HitTest method is called.

Coordinates where the mouse click occurred. Gets the current view for the Calendar. Current view for the Calendar. String representation for the DateTime property.

Date is a String property that represents the value in DateTime as a string data type. Reading the value in Date calls the GetProps method to get the current value for DateTime, and converts it to its string representation. Setting the value in Date calls the SetProps method to store the new value for both Date and DateTime.

Raises an EInvalidDate exception when Date contains an invalid date value.

Native data type used for a date in the calendar control.

DateTime is a TDateTime property that contains the native data type used for a date in the calendar control. Reading the value in DateTime calls the GetProps method to get the current values for Date and DateTime. Setting the value in DateTime calls SetProps to update the values in Date and DateTime.

For the Windows environment, the CalendarMinDate and CalendarMaxDate member variables are updated to ensure that date values are in an acceptable date/time value range. An EInvalidDate exception is raised if the value is not a valid date/time for the platform.

The calendar control does not use the time portion of the TDateTime data type. The time value is not significant unless a specified value is not valid for the date/time data type.

EInvalidDate exception is raised if the value is not a valid date/time for the platform; raised with the message rsInvalidDateRangeHint.

DisplaySettings contains options which control the appearance of the calendar.

DisplaySettings contains options which control the appearance of the calendar. DisplaySettings is a set type which contains zero or more TDisplaySetting values, including:

dsShowHeadings
Displays a Month/Year heading
dsShowDayNames
Displays Day names
dsNoMonthChange
Prevents changing the month
dsShowWeekNumbers
Displays week numbers
The value dsStartMonday is no longer available in LCL version 2.2 or higher. It has been replaced by the FirstDayOfWeek property on platforms where the capability is supported (Win32, QT, QT5). This is Delphi compatible, and allows any day of the week to be used as the first day of the week.
Indicates the day of the week displayed as the first column in the calendar grid.

FirstDayOfWeek is a TCalDayOfWeek property which indicates the day used as the first day of the week. It contains a value from the TCalDayOfWeek enumeration, and determines the order of the cells displayed in the calendar grid. The default value is dowDefault, and indicates the default value provided by the platform or operating system is used.

OnChange - event handler for any change in Calendar.

OnChange is a TNotifyEvent property that represents the event handler signalled when the date/time value for the control has changed. OnChange is signalled from the LMChanged, LMDayChanged, LMMonthChanged, and LMYearChanged methods. Applications should assign a procedure to the event handle to respond to the message notification.

OnDayChanged - event handler for a change in Day selected.

OnDayChanged is a TNotifyEvent property that represents the event handler signalled when the day number in the date/time value for the control has changed. OnDayChanged is signalled from the LMDayChanged method. Applications should assign a procedure to the event handler to respond to the message notification.

OnMonthChanged - event handler for a change in month selected.

OnMonthChanged is a TNotifyEvent property that represents the event handler signalled when the month in the date/time value for the control has changed. OnMonthChanged is signalled from the LMMonthChanged method. Applications should assign a procedure to the event handler to respond to the message notification.

OnYearChanged - event handler for a change in the year selected.

OnYearChanged is a TNotifyEvent property that represents the event handler signalled when the year in the date/time value for the control has changed. OnMonthChanged is signalled from the LMYearChanged method. Applications should assign a procedure to the event handler to respond to the message notification.

TCalendar allows selection of a date from a calendar display.

TCalendar is a graphic control allowing the user to select a date from a calendar display.

Registers components for use in the Lazarus IDE.

Register is the procedure used to register components for use in the Lazarus IDE. The following components are added to the Lazarus IDE component palette:

Misc Tab

  • TCalendar