RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDBEdit.KeyPress Method

Supplements the inherited method to handle any keystrokes that alter the state of the edit control.

Pascal
procedure KeyPress(var Key: Char); override;
C++
virtual __fastcall KeyPress(Char Key);

KeyPress first calls the inherited method, which calls the OnKeyPress event handler. Next, KeyPress discards the keystroke if it is not a valid character for the field type, or if there is no link to a database field. Valid characters cause KeyPress to attempt to put the dataset into edit mode.  

Pressing the Escape key causes KeyPress to call Reset, throwing away all unposted edits.

Note: KeyPress is a protected method. Applications cannot call it directly. It is called automatically in response to user actions.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!