ConWaitKey$ function

 

Usage:

[StrVar$ =] ConWaitKey$ [(KeyMask$ [,TimeOut&])]

 

Legacy Syntax:

[StrVar$ =] WAITKEY$ [([KeyMask$],[TimeOut&])]

 

Pseudo-object Syntax:

[StrVar$ =] CON.WAITKEY$ [([KeyMask$],[TimeOut&])]

 

Returns a keyboard or mouse event from the console input buffer, waiting for input.

 

Nothing is echoed to the screen. ConWaitKey$ is very similar to ConInKey$, and returns the same results, except that ConWaitKey$ waits for input to be available. While waiting, the CPU is released for other tasks.

 

If the optional KeyMask$ expression is specified, ConWaitKey$ will recognize only a limited specified set of key or mouse events. KeyMask$ may include any number of sub-masks, one for each key or mouse event to observe. For example, ConWaitKey$("YyNn") will recognize upper-case or lower-case Y or N (for yes/no answers), while any other key or mouse event will be ignored. If KeyMask$ is omitted, or if it evaluates to a zero-length string, any key event or mouse event will be recognized.

 

If the optional TimeOut& expression is included, ConWaitKey$ will wait for the specified maximum number of milliseconds for a key or mouse event. For example, ConWaitKey$("",5000) will wait for a maximum of 5 seconds (approximately). If the time-out period is exceeded, a zero-length string is returned. If the TimeOut& parameter is omitted, or evaluates to zero (0), it will wait an infinite length of time. If you wish to specify a time-out without specifying a mask, include a null string in the KeyMask$ position.

 

Conversion:

 

#IF %DEF(%PB_CC32)

  StringVar$ = WAITKEY$

#ELSE

  StringVar$ = ConWaitKey$

#ENDIF

 

#IF %DEF(%PB_CC32)

  StringVar$ = WAITKEY$(KeyMask$)

#ELSE

  StringVar$ = ConWaitKey$ (KeyMask$)

#ENDIF

 

#IF %DEF(%PB_CC32)

  StringVar$ = WAITKEY$(KeyMask$, TimeOut&)

#ELSE

  StringVar$ = ConWaitKey$ (KeyMask$, TimeOut&)

#ENDIF

 

#IF %DEF(%PB_CC32)

  StringVar$ = WAITKEY$(, TimeOut&)

#ELSE

  StringVar$ = ConWaitKey$ ("", TimeOut&)

#ENDIF

 

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

 

Only PB/CC6+ supports the KeyMask$ and Timeout& optional parameters.

 

See also: ConInKey$