MSM-Workstation
Macros

Go back to the alphabetic list of macros
Go back to the first page of this tutorial

%%EvKey

This macro generates code that returns a specification of the value of a property of the most recent event.

The property for which the value is returned by this macro is the list of keys that were depressed when the event occurred, which is equal to ^$Event("KEY").

When keys are struck on the keyboard, multiple events are triggered. For each key, there is at least a keyDown and a keyUp. When the combination of the key and the modifier keys represents a valid character, there will also be a char event.

In the context of the events keyDown and keyUp, the value in ^$EVENT("KEY") or %%EvKey will be the descriptive text, e.g. "SHIFT+A", or "A", or "ESC"). In the context of the event char, the value reported will be string-value that represents the character in question, e.g. "A", "a" or $Char(27) in the same cases as above.

The special function keys are: "ESC", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F12", "BACKSPC", "SCRLLCK", "PAUSE", "TAB", "ENTER", "INS", "HOME", "PAGEUP", "PAGEDOWN", "END", "DEL", "UP", "LEFT", "RIGHT", "DOWN", "NUMLOCK", "NUMDIV", "NUMMULT", NUMMINUS", "NUMPLUS", "NUM0", "NUM1", "NUM2", "NUM3", "NUM4", "NUM5", "NUM6", "NUM7", "NUM8", "NUM9", "NUMENTER", "NUMDEC".

Print Screen is reported as "Z44". Since the "key down" event is caught by the operating system, only a keyUp, will be "seen" by MSM-Workstation.
The key with label 5 on the numeric keyboard, when "Num Lock" is off, is reported as "Z12", in the case of this key, the operating system catches the "key up" event, so only a a keyDown will be "seen" by MSM-Workstation.

Note that the key F9 toggles a keyboard-lock. When the toggle is "on", no other keys will be "seen" by MSM-Workstation, and a beep will sound. Pressing F9 again will release the lock.

The modifier keys are: "SHIFT", "CAPSLOCK", "ALT", "CTRL".

Note: When one of the components of a window is a "default button", the depression of the enter key will not be visible as a "character oriented" event. Instead, a lostFocus event will be triggered, reporting the name of the default button as the component that will receive focus as the result of pressing the enter key.

Examples

If %%EvKey="ENTER" Do ...
Recognize the "enter" key in the context of one of the events keyDown or keyUp.

If %%EvKey=$Char(13) Do ...
Recognize the "enter" key in the context of the event char.

See also

%%EvChoice, %%EvControl, %%EvElement, %%EvNext, %%EvPrior, %%EvPtrButton, %%EvPtrPos, %%EvPtrState, %%EvSequence, %%EvType and %%EvWindow.