Language Reference Guide : System Classes : KeyDownData Class : VirtualKey Attribute
 
Share this page          
VirtualKey Attribute
Data Type: integer
4GL Access: RW
This attribute contains the virtual key code for the key. Note that the code distinguishes between the left and right Shift, Control, and Alt keys. The virtual key for these keys is as follows: 
Left Shift key
160
(VK_LSHIFT)
Right Shift key
161
(VK_RSHIFT)
Left Control key
162
(VK_LCONTROL)
Right Control key
163
(VK_RCONTROL)
Left Alt key
164
(VK_LMENU)
Right Alt key
165
(VK_RMENU)
All virtual key values are defined in Virtual Key Values.
You can intercept a key down message and prevent further processing of the WM_KEYDOWN or WM_SYSKEYDOWN message by setting the VirtualKey attribute to zero in the KeyDown or ChildKeyDown event block, as in the following example:
/* the virtual key code for the A key is 65.  */

on ChildKeyDown =
declare
     KeyData    = KeyDownData default NULL;
     VirtualKey = integer not null;
begin
     KeyData    = KeyDownData(CurFrame.MessageObject );
     VirtualKey = KeyData.VirtualKey;

     /*  Do no further processing of the A key  */

     if (VirtualKey = 65) then
          KeyData.VirtualKey = 0;
     endif;
end