Icon TKeyPressEvent

Unit: WebCtrls

TKeyPressEvent = function (Sender: TObject; Key: Char; ShiftKey,
      CtrlKey, AltKey: Boolean): Boolean of object

Available In: Client and Server Applications

The TKeyPressEvent type is a common event type that is used by controls to provide notification that a key has been pressed.

The Sender parameter represents the class instance that triggered the event. The Key parameter represents the character key code of the key pressed, and the ShiftKey, CtrlKey, AltKey parameters represent whether the Shift, Control, and/or Alt keys were also pressed.

Warning Certain keys, such as the Insert, Delete, and navigation keys, use virtual key codes since these keys do not correspond to a Unicode character value. Only use this event to handle keystrokes that correspond to Unicode character values. Use the OnKeyDown event to handle keystrokes that use virtual key codes.

To not allow the keystroke, return False as the result to any event handler attached to this event. To allow the keystroke, return True.