Console_WaitKey
<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > Console > Console_WaitKey |
Description
Waits until a keys was been pressed (within a timeout) then it retuns it.
Syntax
Console_WaitKey[(nSecsTimeOut [, TestToPrint] ) ]
Returns
Return a string
Returns the key pressed like encloses into a square brakets.
Parameters
Name |
Type |
Optional |
Meaning |
nSecsTimeOut |
Numeric |
Yes |
Specifies the maximum number of seconds to wait for a key (timeout) |
TestToPrint |
String |
Yes |
An optional Text to Print. Syntax to use is the same that is avaliable for PrintL function, all the options are available including colors This option can avoid to have a PrintL command before to give information to the user |
Remarks
Specials keys are returned like:
[F1]
[F2]
[F3]
[F4]
[F5]
[F6]
[F7]
[F8]
[F9]
[F10]
[F11]
[F12]
[UP]
[DOWN]
[LEFT]
[RIGHT]
[PGUP]
[PGDOWN]
[HOME]
[END]
[CANC]
[DELETE]
[TAB]
[RETURN]
[ESC]
[ALT]
[CTRL]
[SHIFT]
Or if timeout is expired:
[TIMEOUT]
Restrictions
Alias
See also
Console Module, Console_Read, Console_ReadLine
Examples
Console_WriteLine("Key pressed: " + Console_WaitKey(10))
' if the caps lock is enabled and the user press the X key,
' results: Key pressed: [X]