JavaScript Editor js editor     Web development 



Main Page

Determines whether or not a character is present in the keyboard buffer.

CHRSAW([nSeconds])

Parameters

nSeconds


Specifies the time in seconds that CHRSAW(В ) waits before checking the keyboard buffer. The keyboard buffer is checked immediately if you omit nSeconds. Including nSeconds lets you use CHRSAW(В ) for a variety of timed activities. For example, your program can close an application if a key hasn't been pressed for a specific number of seconds.

Return Value

Logical

Remarks

CHRSAW(В ) returns True (.T.) if a character is present in the keyboard buffer, and False (.F.) if not. CHRSAW(В ) doesn't affect the keyboard buffer contents.

Example

In the following example, the system displays a window containing input fields created with @В ...В GET commands, and waits 5 seconds for keyboard input. If a key isn't pressed in this time period, CHRSAW(В ) returns False (.F.) and the program terminates.

В Copy Code
SET TALK OFF
DEFINE WINDOW wEnter FROM 7,10 to 13,70 PANEL
ACTIVATE WINDOW wEnter
@ 1,3 SAY 'Customer: '   GET gcCustomer  DEFAULT SPACE(40)
@ 3,3 SAY 'Address:  '   GET gcAddress  DEFAULT SPACE(40)
WAIT WINDOW 'Waiting for input' NOWAIT
IF NOT CHRSAW(5)   
   DEACTIVATE WINDOW wEnter
   CLEAR GETS
ELSE
   READ
   DEACTIVATE WINDOW wEnter
ENDIF
RELEASE WINDOW wEnter
WAIT 
CLEAR

See Also



JavaScript Editor js editor     Web development