ConWaitStat function

 

Usage:

[Result& =] ConWaitStat [Timeout&]

 

Legacy Syntax:

WAITSTAT

 

Pseudo-object Syntax:

CON.WAITSTAT

 

Waits until an input event is ready to be retrieved from the console.

 

Returns when a key is pressed (except shift and lock keys) or a trapped mouse event occurs. The key or mouse event is not removed from the console input buffer. While waiting, the CPU is released for other tasks.

 

Because ConWaitStat does not remove the event from the input buffer, if the event is not removed using ConInKey$, ConWaitKey$ or ConFlush, subsequent calls to ConWaitStat will return immediately. ConWaitStat is not subject to redirection.

 

The mouse must be enabled with the ConMouse and ConMouseOn commands for mouse events to be reported.

 

If the optional TimeOut& expression is included, ConWaitStat will wait the specified maximum number of milliseconds for a key or mouse event. For example, ConWaitStat(5000) will wait for a maximum of 5 seconds (approximately). If the TimeOut& parameter is omitted, or evaluates to zero (0), it will wait an infinite length of time.

 

If the time-out period is exceeded, a FALSE result is returned. If the time-out period is not exceeded, or if it is not specified, a TRUE result is returned.

 

Conversion:

 

#IF %DEF(%PB_CC32)

  WAITSTAT

#ELSE

  ConWaitStat

#ENDIF

 

CON.WAITSTAT or CONSOLE.WAITSTAT may be substituted for WAITSTAT in programs written for PB/CC6.

 

PB/CC does not include a time-out on WAITSTAT.

 

See Also: ConInStat, ConInKey$, ConWaitKey$, ConFlush