TWinControl.KeyDown procedure
Signals OnKeyDown event handlers (when assigned).
Declaration
procedure KeyDown(var Key: Word; Shift: TShiftState); virtualArguments
Key | Numeric key code examined and handled in the method. |
Shift | Shift, Ctrl, or Alt modifier for the key. |
Description
KeyDown is a method used to signal the assigned
OnKeyDown event handler(s) for the control. It provides arguments
with the virtual key code and the state modifiers for the TKeyEvent type.
KeyDown signals the OnKeyDown event handler (when assigned). The handler routine can modify the Key argument if it is handled (or discarded) in the event handler. Set Key to VK_UNKNOWN (0) in the handler routine if the key event is either applied or discarded by the handler.
When Key has a non-zero value - because OnKeyDown was not assigned or did not handle the key - DoCallKeyEventHandler is called to check other chtOnKeyDown handlers added to the control using AddHandler or AddHandlerOnKeyDown.
KeyDown is called from the KeyDownBeforeInterface method. It occurs after the Application, any forms with KeyPreview enabled, and the active DragManager have examined and possibly handled the key event.
See KeyUp for the actions performed when the key is released.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
