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

# TLCLTaskDialog.KeyDown

Implements the OnKeyDown event handler for the task dialog.

## Declaration

Source position: taskdlgemulation.pp line 166

`public procedure TLCLTaskDialog.KeyDown(`
`var Key: Word;`
`Shift: TShiftState`
`); override;`

## Arguments

`Key` |  | Virtual key code examined in the method.
`Shift` |  | Shift, Control, or Alt modifier for the key.

## Description

KeyDown is an overridden method in TLCLTaskDialog which implements the handler routine for OnKeyDown events in the dialog form. KeyDown ensures that Esc, Alt+F4, and F1 key down events are applied properly for the emulated task dialog.

When BorderIcons indicates that the dialog form can be closed (contains biSystemMenu), the Esc (Escape) key can be used to close the dialog form by calling the Close method. Without the system border icon, the Esc key is not handled in the method.

When Key and Shift indicate that the Alt+F4 key was pressed, the value in Key is digested (set to 0). The native task dialog blocks Alt+F4 to close the dialog, so it is blocked in the emulated task dialog as well.

When Key indicates that F1 was pressed, the DoOnHelp method in the TTaskDialog instance is called to signal an assigned OnHelp event handler in the task dialog. The value in Key is set to 0 to consume the key event.

KeyDown calls the inherited method prior to exit.

## See also

TForm.BorderIcons |  | Specifies the icons which appear in the title bar for the form.
TWinControl.KeyDown |  | Signals OnKeyDown event handlers (when assigned).
TWinControl.OnKeyDown |  | Event handler signalled for key down keyboard events.
TShiftState