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

# TWinControl.KeyPress

Signals the OnKeyPress event handler (when assigned).

## Declaration

Source position: controls.pp line 2273

`protected procedure TWinControl.KeyPress(`
`var Key: Char`
`); virtual;`

## Arguments

`Key` |  | Character value for the key press event.

## Description

KeyPress is called from the DoKeyPress method when the parent form does not have KeyPreview enabled or does not handle the character code in Key. KeyPress is not called if csNoStdEvents has been included in the ControlStyle property.

See UTF8KeyPress for the actions performed for a UTF-8-encoded character in a key press.

## See also

TWinControl.UTF8KeyPress |  | Signals the OnUTF8KeyPress event handler (when assigned).