Keyboard Module

An intrinsic object that represents the current state of the keyboard.

Properties
AlternateMenuShortCutKey | AsyncKeyDown | MenuShortcutKey
AltKey | AsyncMenuShortcutKey | OSKey
AsyncAlternateMenuShortCutKey | AsyncOSKey | ShiftKey
AsyncAltKey | AsyncShiftKey |
AsyncControlKey | ControlKey |

Methods
Keyname

# Notes

The Keyboard object is used to determine if particular keys are being pressed. The async version of each keyboard properties tell you the immediate state of the key. If you want to know the state of the key when an event was queued, you should use the non-async version of the properties. These properties are updated constantly during code execution.

## Windows

You can pass raw Win32 key codes to AsyncKeyDown. Add 1 to the raw keyCode and put it in the high word of the Integer you are passing. For example:

Keyboard.AsyncKeyDown((rawKeyCode + 1) * &hFFFF)

The 'regular' way of detecting a particular keyCode, illustrated by the first example in the Examples section, also works for Windows.

# Examples

The following example tests whether the key for the letter "A" was pressed:

If Keyboard.AsynckeyDown( &h00) then
//do somthing with this key here
end if

This example monitors the arrow keys and detects when an arrow key is pressed. Place it in the Action event of a Timer and it will monitor the keyboard continuously.

If Keyboard.AsyncKeyDown(123) then
//do something with the left arrow key
end if
If Keyboard.AsyncKeyDown(124) then
//do something with the right arrow key...
end if
If Keyboard.AsyncKeyDown(125) then
//do something with the down arrow key...
end if
If Keyboard.AsyncKeyDown(126) then
//do something with the Up arrow key...
end if