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

# TCalendarPopupForm.CalendarKeyDown

Implements the OnKeyDown event handler for the Calendar control.

## Declaration

Source position: calendarpopup.pas line 33

`procedure TCalendarPopupForm.CalendarKeyDown(`
`Sender: TObject;`
`var Key: Word;`
`Shift: TShiftState`
`);`

## Arguments

`Sender` |  | Object for the event notification; the Calendar control in this case.
`Key` |  | Virtual key code examined in the method.
`Shift` |  | Virtual key modifier examined in the method.

## Description

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.

## See also

TCustomForm.Close |  | Closes the form.