KeyCount

Description:              This function returns the number of keys pressed since the state became active, either edited or non-edited.

Returns:                    Numeric

Usage:                       Steady State

Format:                      KeyCount(Option)

Parameters:             Option     { Boolean }  { required }  { no default }

                                      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. When the Backspace key is pressed, the key code for backspace is entered as a non-edited keystroke, and the previous edited keystroke is removed. That is, when Backspace is pressed the number or non-edited keystrokes increments, and the number of edited keystrokes decrements (and possibly goes negative).

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 is the beginning of a loop which would process keystrokes one at a time (such as a text editor).

See Also:

KeyFake | Keys | MatchKeys | ReadNum | ReadText