Implements a pop-up form with a TCalendar control for TDateEdit Specifies an event handler signalled when a date is selected on a pop-up calendar form

TReturnDateEvent specifies an event handler signalled when a date is selected on a pop-up calendar form. TReturnDateEvent is the type used to implement the OnReturnDate event handler in TCalendarPopupForm. Applications must implement an object procedure used to respond to the event notification. It is passed as an argument to the ShowCalendarPopup routine.

Object for the event notification; normally the pop-up calendar form TDateTime value for the date selected on the calendar form Implements a non-modal pop-up form used to select a date from a TCalendar control

TCalendarPopupForm is a TForm descendant which implements a non-modal pop-up form used to select a date with a TCalendar control. It includes the OnReturnDate event handler to perform the actions needed when a date is selected using the Calendar control.

TCalendarPopupForm is used as the non-modal dialog executed when the Button for the TDateEdit control is clicked.

Use the ShowCalendarPopup routine to create, configure, and display a pop-up calendar form.

TCalendar control used to select a date on the form

Calendar is a TCalendar member which contains the calendar control displayed on the form. It allows selection of date, and calls the ReturnDate method when the Month, Day, or Year in the control is changed using either the mouse or the keyboard. Calendar is configured in the Initialize method using the TDateTime and TDisplaySettings provided as arguments.

Use the ShowCalendarPopup routine to provide the date/time value and display settings needed in the pop-up calendar form.

Performs actions needed when a double click mouse event occurs in the Calendar control

CalendarDblClick ensures that the mouse event is within the bounds for the Calendar control by calling its HitTest method. When the mouse event occurs on the Month or Year calendar parts, the ReturnDate method is called to signal the OnReturnDate event handler and close the form.

Implements the OnKeyDown event handler for the Calendar control

CalendarKeyDown is a procedure which implements the OnKeyDown event handler for the Calendar control. The method ensures that the key down virtual key code represented by Key and Shift is applied to the Calendar control, and includes:

VK_RETURN, VK_SPACE
Calls ReturnDate to apply the selected date value in Month view, and signals the OnReturnDate event handler.
VK_ESCAPE
Calls Close to close the form.

If the virtual key code is handled in the method, the value in Key is set to zero (0). Otherwise, it is retained for use in event handlers at the Form or Application level.

Object for the event notification; the Calendar control in this case Virtual key code examined in the method Virtual key modifier examined in the method Implements the OnClose event handler for the form

Ensures that the FormDeactivate method is removed from the registered OnDeactivate handlers in Application. The value in CloseAction is set to caFree in the method.

Object for the event notification Close action to perform on exit from the event handler Implements the OnCreate event handler for the form Object for the event notification Implements the OnDeactivate event handler for the form

Ensures that the FormDeactivate method is added to the OnDeactivate handlers in Application.

Object for the event notification Configures the Calendar control in the pop-up form

Applies the values in the ADate and DisplaySettings arguments to the Calendar control.

Date value assigned to the Calendar control Display settings applied to the Calendar control Ensures that the form and the calling control are visible on the current monitor Coordinates where the pop-up form is displayed Signals the OnReturnDate event handler using the DateTime value in the Calendar control

Calls Close to close the form if it has not already been executed.

Creates, configures, and displays a TCalendarPopupForm instance

ShowCalendarPopup is a procedure used to create, configure, and display a TCalendarPopupForm instance. ShowCalendarPopup stores arguments to the routine in properties for the pop-up calendar form, and calls its Initialize method to configure the Calendar control.

ShowCalendarPopup calls the Show in the form to make it visible, and calls KeepInView to ensure that the form is fully visible on the current monitor.

Coordinates where the pop-up calendar form is displayed Initial date displayed in the Calendar for the form Display settings applied to the Calendar control Event handler signalled when a new date value is selected Event handler signalled when the pop-up form is shown or hidden The control which creates the pop-up and captures its return value