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

TWinControl.OnKeyPress

Event handler signalled for character data entered by the user.

Declaration

Source position: controls.pp line 2360

public property TWinControl.OnKeyPress : TKeyPressEvent
  read FOnKeyPress
  write FOnKeyPress;

Description

This handler only receives characters, not control or other special key codes. Control keys should be handled by an OnKeyDown handler instead. The handler can also be used to convert the character into a different one.

Remark: We recommend using OnUTF8KeyPress to prevent data loss. Characters are converted from UTF-8 to the system encoding in OnKeyPressEvent, with possible loss of characters outside the ANSI codepage.

See also

TWinControl.OnKeyDown

  

Event handler signalled for key down keyboard events.

TWinControl.OnUTF8KeyPress

  

Handler for a character entered by the user.


Version 3.2 Generated 2024-02-25 Home