Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Waits until a keys was been pressed (within a timeout) then it returns it.

 

Syntax

 

Console_WaitKey [ (nSecsTimeOut [, TextToPrint] ) ]

 

Or

 

WaitKey [ (nSecsTimeOut [, TextToPrint] ) ]

 

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)

TextToPrint

String

Yes

An optional Text to Print.
Syntax to use is the same that is available for PrintL function, all the options are available including colors

This option can avoid to have a PrintL command just before wait in order to give user some information

 

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

 

WaitKey

 

See also

 

Console Module, Console_Read, Console_ReadLine

 

Examples

 

...

 

Printl("Key pressed: " + Console_WaitKey(10))

' if the caps lock is enabled and the user press the X key,

' results: Key pressed: [X]

 

...

 

  WaitKey
  WaitKey 0
  WaitKey 0, "Test" In %CCOLOR_BCYAN
  WaitKey (0)
  WaitKey(0, "Press a key to continue")
  WaitKey 0, "Press a key to continue"
  WaitKey "Press a key to continue" In %CCOLOR_FGREEN
  WaitKey 3, "Wait 3 secs or press a key to continue"

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software