KeyCount
(Engine-Level Function)
Description: | Returns the number of keys pressed since the state became active, either edited or non-edited. |
Returns: | Numeric |
Usage: | Steady State only. |
Function Groups: | Keyboard |
Related to: | KeyFake | Keys | MatchKeys |
Format: | KeyCount(Option) |
Parameters: |
Option |
Any logical expression. If true, the number of non-edited keystrokes is returned; if false, the edited keystrokes is returned. |
Comments: |
Edited keystrokes are printable characters and the enter key. Non-edited keystrokes are all keystrokes, including printable characters, enter key, special keys, and function keys. Count keys only while the calling state (window) has focus. |
Examples:
If KeyCount(1) MainMenu;
This action simply waits for any key to be pressed, and changes to another state. Another way of using this function would be:
If KeyCount(1) > KeysChecked;
This checks that the number of non-edited keys pressed is greater than the value of keysChecked. This might be the beginning of a loop that would process keystrokes one at a time (such as a text editor).