Language Reference Guide : 5. Events : ChildKeyDown Event
 
Share this page                  
ChildKeyDown Event
The ChildKeyDown event is triggered whenever OpenROAD receives a WM_KEYDOWN or WM_SYSKEYDOWN message. The event is not queued, but is generated immediately.
Information about the key is stored in a KeyDownData object, which is delivered to the 4GL program in the MessageObject attribute of the FrameExec, which is inherited from the GhostExec class. The 4GL event code has the opportunity to stop further processing of the WM_KEYDOWN or WM_SYSKEYDOWN message by modifying the KeyDownData object. To discard the message, set the KeyDownData.VirtualKey to zero. The PrintScrn key does not cause a ChildKeyDown event and no other events are generated in conjunction with a ChildKeyDown event.
In particular, the ChildKeyDown event does not cause either a SetValue or a ChildSetValue event.
For a listing of virtual key codes and their values, see Virtual Key Values.
In the following example, processing of the 'A' Key is stopped:
/* the virtual key code for the A key is 65. */
on ChildKeyDown =
declare
   KeyData    = KeyDownData default NULL;
   VirtualKey = integer not null;
enddeclare
begin
   KeyData     = KeyDownData(CurFrame.MessageObject);
   VirtualKey  = KeyData.VirtualKey;
   /*  No further processing of the A key  */
   if (VirtualKey = 65) then
      KeyData.VirtualKey = 0;
   endif;
end
This event has the following syntax:
on ChildKeyDown
The following attribute of the FrameExec class, which is inherited from the GhostExec class, can be used in the ChildKeyDown event block:
MessageObject
Specifies a KeyDownData object that contains information about the key that caused the ChildKeyDown event
More information:
MessageObject Attribute (GhostExec Class)