5. Events : ChildKeyPress Event
 
Share this page                  
ChildKeyPress Event
The ChildKeyPress 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 KeyPressInfo 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, set KeyPressInfo.ANSICode to zero.
The ChildKeyPress event is generated only when the user presses an ANSI key. Thus, the Delete key, for example, does not cause a ChildKeyPress event.
This event has the following syntax:
on ChildKeyPress [compositefieldname]
The following attributes of the FrameExec class can be used in the ChildKeyPress event block:
MessageObject
Specifies a KeyPressInfo object that contains information about the keystroke
OriginatorField
Specifies the field specified in the on ChildKeyPress statement
TriggerField
Specifies the EntryField that received the keystroke
More information:
MessageObject Attribute (see page MessageObject Attribute)
OriginatorField Attribute (see page OriginatorField Attribute)
TriggerField Attribute (see page TriggerField Attribute)