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

# TWinControl.DoUTF8KeyPress

Performs actions needed to handle a UTF-8-encoded key press message for the control.

## Declaration

Source position: controls.pp line 2263

`protected function TWinControl.DoUTF8KeyPress(`
`var UTF8Key: TUTF8Char`
`):Boolean; virtual;`

## Arguments

`UTF8Key` |  | UTF-8-encoded character examined in the method.

## Function result

True if the key was handled.

## Description

DoUTF8KeyPress is a Boolean function used to handle a key press event for a UTF-8-encoded value received for the control. The return value is True if the character code in the specified Message is handled for the control.

DoUTF8KeyPress allows a TCustomForm instance in Parent with KeyPreview enabled to handle the notification message using its DoUTF8KeyPress method. If the character code is handled, the return value is set and no further actions are performed in the method.

The return value is False when standard events have been disabled by including csNoStdEvents in the ControlStyle property.

When not disabled, the UTF8KeyPress method is called using the character code in Message as an argument. If the character was handled in the OnUTF8KeyPress event handler, the return value is True.

At design-time, DoUTF8KeyPress redirects the key event to the active design surface in the Lazarus IDE.

DoUTF8KeyPress is called from the IntfUTF8KeyPress method when a CN_CHAR control notification message is received for the control. DoUTF8KeyPress is called after KeyDown has been executed.

## See also

TWinControl.OnUTF8KeyPress |  | Handler for a character entered by the user.
TWinControl.IntfUTF8KeyPress |  | Called by the interface after the navigation and specials keys are handled; i.e. after KeyDown but before KeyPress.
TWinControl.OnKeyPress |  | Event handler signalled for character data entered by the user.
TWinControl.DoKeyPress |  | Performs actions needed to handle a key press message for the control.
TWinControl.CNChar |  | Handler for a key pressed notification; CNChar is sent by the widget before it has handled the key press itself.
TControl.ControlStyle |  | Contains style flags which control the features or behaviors enabled for the control.