Constant | Description |
---|---|
xbeK_ALT | Determines the state of the Alt key |
xbeK_CTRL | Determines the state of the Ctrl key |
xbeK_SHIFT | Determines the state of the Shift key |
xbeK_INS | Determines the state of the Insert key |
xbeK_NUM_LOCK | Determines the state of the Num Lock key |
xbeK_CAPS_LOCK | Determines the state of the Caps Lock key |
Function AppKeyState() Foundation
Determines and optionally changes the state of keys.
AppKeyState( <nKeyDefine> [,<nMode>] ) --> nKeyState
AppKeyState( <nKeyDefine> [,<lGetToggleState>] ) --> nKeyState *)
*) Deprecated syntax.
Constant | Description |
---|---|
APPKEY_GET_PRESSED *) | AppKeyState() returns APPKEY_DOWN if the key is currently pressed (held down) |
APPKEY_GET_TOGGLED | AppKeyState() returns APPKEY_TOGGLED if a key, such as Num Lock, is currently toggled (on) |
APPKEY_SET_PRESSANDRELEASE | Simulates a key-press of the specified key. Can be used to toggle the state of special keys such as Num Lock |
|
The function returns a numeric value equivalent to the following #define constants:
Constant | Description |
---|---|
APPKEY_IDLE | The key is not pressed (or toggled off) |
APPKEY_DOWN | The key is pressed |
APPKEY_TOGGLED | The key is toggled (on) |
The return value is always the current state of the specified key. Even if the <nMode> parameter is set to APPKEY_SET_PRESSANDRELEASE, simulating a key press, the return value is always the state prior to the simulation of the key press.
The function determines the current state of selected keys. The primary usage of AppKeyState() is to query special keys for which no events are generated by the AppEvent() function. For example, this allows testing whether or not the Ctrl key is pressed, while processing a Left Button Down (xbeM_LbDown) event.
By default (<nMode> is APPKEY_GET_PRESSED), the return value of AppKeyState() indicates whether the specified key is currently pressed/held down (APPKEY_DOWN) or not (APPKEY_IDLE). If APPKEY_GET_TOGGLED is used, the return value will be either APPKEY_IDLE or APPKEY_TOGGLED, alternating every time the key is pressed. By itself, this information is only meaningful for the three toggle keys (Caps Lock, Num Lock, and Scroll Lock), but it can also be used to assign an arbitrary status to any key. For example, the toggle state of the Insert key could be treated as an indicator for switching between Overwrite and Insert Mode.
If the #define constant APPKEY_SET_PRESSANDRELEASE is assigned to the <nMode>parameter, AppKeyState() simulates a key-press of the specified key. This can be used to programmatically modify the toggle state of special keys such as Num Lock, Caps Lock, or the Insert key.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.