Language Reference Guide : System Classes : KeyDownData Class : Modifiers Attribute
 
Share this page          
Modifiers Attribute
Data Type: smallint
4GL Access: R
This attribute indicates which modifier keys are pressed at the time of the KeyDown or ChildKeyDown event. The value of the Modifiers attribute enables you to determine whether the key is modified by the Shift, Ctrl, or Alt keys; it also lets you distinguish between the left and right modifier keys.
This attribute contains bits that indicate which modifier keys are pressed. Three bits indicate the state of the modifier keys without distinguishing between the left and right keys:
1
Shift
2
Control
4
Alt
In addition to these bits, there are other bits that let you determine the state of the left and right modifier keys:
  16
Left Shift
  32
Right Shift
  64
Left Control
128
Right Control
256
Left Alt
512
Right Alt
Although the 4GL language does not provide for explicit bit testing, it can be done using the mod function. For example, the following code tests to see if the left control key is down (where KeyDown is a KeyDownData object):
if (mod(KeyDown.Modifiers, 128) >= 64) then
  /* Left control key is down. */
else
  /* Left control key is up. */
endif;