WaitForKeys Method

image\btn_example.gif

image\validfor_amv.gif

Applies To Objects

Screen

Description

Waits until the user presses a key or for the specified time to elapse before the program will continue processing.

Syntax

object.WaitForKeys [Timeout] [, UserKeys] [, bProcess]
-or-

rc = object.WaitForKeys ( [Timeout] [, UserKeys] [, bProcess] )
-or-

Set waitobj = object.WaitForKeys ( [Timeout] [, UserKeys] [, bProcess] )

 

Element

Description

object

The Screen object.

Timeout

The length of time to wait for a keystroke, in milliseconds. If no Timeout value is specified, this method waits until a key is pressed.

UserKeys

A particular keystroke or string that the user must type for the program to continue processing. If not specified, any key will satisfy the wait.

bProcess

Boolean value indicating whether keystrokes should continue to be processed by the emulator and sent to the host while waiting for a particular keystroke. Default is TRUE.

rc

Return value for the second syntax form above. If UserKeys was not provided or if it is an empty string, the return value will contain the keystroke pressed. If a timeout occurs, the return value will be an empty string.

Set

The Set statement, required for assigning an object reference to a variable.

waitobj

A wait-type object.

Comments

When the first or second syntax form above is used, WaitForKeys will suspend execution of your macro or program until the user presses a specific key, or any key, or a timeout occurs. If the third form is used, WaitForKeys will return immediately and the wait-type object returned can be used with the Waits collection, which allows several separate events to be monitored simultaneously. For more information, see help for the Waits object.