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

# TControl.DoCallKeyEventHandler

Passes key events for the specified type to the handlers added to the control.

## Declaration

Source position: controls.pp line 1549

`protected procedure TControl.DoCallKeyEventHandler(`
`HandlerType: TControlHandlerType;`
`var Key: Word;`
`Shift: TShiftState`
`);`

## Arguments

`HandlerType` |  | Type for the handler, like OnKeyDown.
`Key` |  | Key code for the key event notification.
`Shift` |  | Shift, Ctrl, or Alt modifier for the key event notification.

## Description

DoCallKeyEventHandler iterates over the handler routines using the type specified in HandlerType. The routines are cast to the TKeyEvent type used to implement the handler and receives the arguments specified in Key and Shift. The current class instance is used as the Sender for the event notification.

DoCallKeyEventHandler is called from the KeyDown method in descendent classes like TWinControl.

## See also

TWinControl.KeyDown |  | Signals OnKeyDown event handlers (when assigned).
TControlHandlerType |  | Notification handler types.
TKeyEvent |  | Defines an event handler for key events.
TShiftState