Language Reference Guide : System Classes : MouseData Class : KeyModifiers Attribute
 
Share this page          
KeyModifiers Attribute
Data Type: integer
4GL Access: R
The KeyModifiers attribute indicates which modifier keys are pressed at the time of the MouseDown or ChildMouseDown event. The value of the KeyModifiers 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:
Bits 1–3
1 – Shift
2 – Control
4 – Alt
The following bits let you determine the state of the left and right modifier keys:
Bits 4–9
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, you can accomplish this using the mod function. For example, the following code tests to see if the left Control key is down (where MouseInfo is a MouseData object):
if (mod(KeyDown.Modifiers, 128) >= 64) then
    /* Left control key is down. */
else
    /* Left control key is up. */
endif;