TCalendarDialog.Execute function
Creates and displays the form for the calendar dialog, and captures the results.
Declaration
function Execute: Boolean; overrideFunction result
True if the OK button was used to close the dialog form.Description
Execute is an overridden method in
TCalendarDialog. It
creates and configures a new TForm instance displayed for the dialog
component. The dialog form includes controls needed to select a
date value, and to accept or reject the selected value. This includes:
- TCalendar
- TButton instances for the OK and Cancel buttons.
Values from properties in the class instance are used to configure the dialog form, including:
- Title
- Used as the Caption for the dialog form.
- DialogPosition
- Sets the Position property in the form instance at run-time. At design-time, the dialog is centered on the screen.
- DisplaySettings
- Sets the display settings used for the TCalendar instance on the dialog form.
- Date
- Sets the initial value for DateTime in the TCalendar instance on the dialog form.
Methods in the class instance are assigned to the event handlers for the dialog form and its controls, including:
- DialogShow
- Assigned to the OnShow event handler in the dialog form.
- DialogClose
- Assigned to the OnClose event handler in the dialog form.
- DialogCloseQuery
- Assigned to the OnCloseQuery event handler in the dialog form.
- CalendarDayChanged
- Assigned to the OnDayChanged event handler in the TCalendar instance on the form.
- CalendarMonthChanged
- Assigned to the OnMonthChanged event handler in the TCalendar instance on the form.
- CalendarYearChanged
- Assigned to the OnYearChanged event handler in the TCalendar instance on the form.
- CalendarChange
- Assigned to the OnChange event handler in the TCalendar instance on the form.
- CalendarDblClick
- Assigned to the OnDblClick event handler in the TCalendar instance on the form.
The ShowModal method for the dialog form is called to display the form and capture the return value. The return value is True if the ModalResult value is mrOK (when the OK button was clicked). The return value is False if the Cancel button was clicked or the form was closed using the window decoration.
The date selected using the calendar control is stored when the CalendarChange routine is executed (via TCalendar.OnChange). This causes the OnChange event handler in the class instance to be signalled to store the updated value.
The form is freed prior to exiting from the method.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
