Sign in Join
FPDoc Onlineexperiment

TWinControl.DoKeyPress function

Member of TWinControlprotectedIn unit Controls

Performs actions needed to handle a key press message for the control.

Declaration

pascal
function DoKeyPress(var Message: TLMKey): Boolean

Arguments

Message

Control Notification message handled in the method.

Function result

True if the key press was handled for the control.

Description

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

DoKeyPress allows a TCustomForm instance in Parent with KeyPreview enabled to handle the notification message using its DoKeyPress 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 KeyPress method is called using the character code in Message as an argument. If the character was handled in the OnKeyPress event handler, the return value is True.

DoKeyPress is called from the CNChar method when a CN_CHAR control notification message is received for the control.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.