From RAD Studio API Documentation
Jump to: navigation, search


property KeyPreview: Boolean read FKeyPreview write FKeyPreview


__property bool KeyPreview = {read=FKeyPreview, write=FKeyPreview, stored=IsForm, default=0};


Type Visibility Source Unit Parent
property public
Vcl.Forms TCustomForm


Specifies whether the form should receive keyboard events before the active control.

If KeyPreview is true, keyboard events occur on the form before they occur on the active control. (The active control is specified by the ActiveControl property.)

If KeyPreview is false, keyboard events occur only on the active control.

Navigation keys (Tab, BackTab, the arrow keys, and so on) are unaffected by KeyPreview because they do not generate keyboard events. Similarly, when a button has focus or when its Default property is true, the Enter key is unaffected by KeyPreview because it does not generate a keyboard events.

KeyPreview is false by default.

See Also

Code Examples