4. Events : KeyPress Event
 
Share this page                  
KeyPress Event
The KeyPress event is triggered when an EntryField has the input focus and the user presses an ANSI key. Information about the key is stored in a KeyPressInfo object, and the KeyPress Info object is delivered to the 4GL program as the MessageObject. The 4GL event code may change the keystroke or cancel it entirely by modifying the KeyPressInfo object. To discard a keystroke, the developer should set KeyPressInfo.ANSICode to zero.
The KeyPress event is generated only when the user presses an ANSI key. Thus, pressing the Delete key, for example, does not cause a KeyPress event.
on keypress [entryfieldname]