Get(ActiveModifierKeys)

Category: Get

Syntax: Get ( ActiveModifierKeys )

Parameters: None

Data type returned: Number

Description:

Returns the sum of the constants that represent the modifier keys that the user is pressing on the keyboard. The constants for modifier keys are as follows:

1Shift

2Caps lock

4Control

8Alt (Windows) or Option (Mac OS)

16Command key (Mac OS only)

When using Get() functions within field definitions, in most cases you should set the storage option to be "unstored" so that the field always displays current data.

Examples:

Get ( ActiveModifierKeys )

Returns 4 if the Control key is being held down, and returns 7 (1+2+4) if the Shift, Caps Lock, and Control keys are being held down.

The following formula can be used to show text values for keys being held down; it can be used in a calculated field or a custom function:

Let ( keys = Get (ActiveModifierKeys); Case (Mod (keys;2); "Shift ") & Case (Int (Mod (keys;4)/2); "Caps Lock ") & Case (Int (Mod (keys;8)/4); "Control ") & Choose ( 2 * (Int (Mod (keys;16)/8)) + (Abs (Get(SystemPlatform)) - 1); "";""; "Option "; "Alt ")& Case (keys>=16; "Command") )

If the user is holding down the Shift, Caps, and Control keys when this function is evaluated, the text values for those keys are returned in the form of Shift, Caps Lock, and Control.

Категории