Keyboard.AsyncKeyDown

From Xojo Documentation

Read-Only Property (As Boolean )
BooleanValue = aKeyboard.AsyncKeyDown(keyCode as Integer)

Supported for all project types and targets.

If True, the key whose KeyCode was passed is depressed. See the tables in the Keyboard Notes section for the values of KeyCode for the English (American) keyboard.

Example

The following example monitors the arrow keys and detects whether one of them is depressed. The code is in the Action event of a Timer control.

If Keyboard.AsyncKeyDown(&h7B) Then
// do something with the left arrow key
End If
If Keyboard.AsyncKeyDown(&h7C) Then
// do something with the right arrow key...
End If
If Keyboard.AsyncKeyDown(&h7D) Then
// do something with the down arrow key...
End If
If Keyboard.AsyncKeyDown(&h7E) Then
// do something with the Up arrow key...
End If