Sign in Join
FPDoc Onlineexperiment

TCustomForm.KeyPreview property

Member of TCustomFormpublicIn unit Forms

Allows the form to intercept keystrokes in child controls.

Declaration

pascal
property 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.

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