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

TCustomForm.KeyPreview

Allows the form to intercept keystrokes in child controls.

Declaration

Source position: forms.pp line 793

public property TCustomForm.KeyPreview : Boolean
  read FKeyPreview
  write FKeyPreview
  default False;

Description

KeyPreview is a Boolean property which controls whether the form can intercept key strokes from child controls.

When KeyPreview is set to True, the form is allowed to receive KeyDown, KeyUp, and KeyPress events before they are received / applied to the ActiveControl in the form. The default value for the property is False.

KeyPreview is used in the implementation of key handling methods in TWinControl. KeyPreview is often enabled for modal dialogs to allow the parent form to handle specific interactions with the user.


Version 3.2 Generated 2024-02-25 Home