DQBinkey$
FUNCTION

Prototype

DECLARE FUNCTION DQBinkey$ ()

Parameters

Returns

If a key is pressed, it returns its character, otherwise a null string

Description

DQBinkey$ works just like the usual INKEY$ QB statement. If any key is being pressed, this function returns its associated character, otherwise it returns a null string.

Notes:

This function works only while the custom keyboard handler is on, otherwise you'll probably crash your system. In addition, as DQBinkey$ does not get the character from the standard keyboard buffer, you'll loose your character if you do not store it in some variable.

Example

*****************************************************************************

' All integers for speed
DEFINT A-Z

'$INCLUDE:'DIRECTQB.BI'

' Let's initialize the library with no extra layers nor sounds nor EMS
IF DQBinit(0, 0, 0) THEN DQBclose: PRINT DQBerror$: END

' Installs the keyboard handler
DQBinstallKeyboard

' Let's prompt the user for a question
PRINT "Press 'Y' if you like DirectQB, otherwise 'N'"
DO
  DO: k$ = DQBinkey$: LOOP WHILE k$ = ""
  SELECT CASE k$
  CASE "Y": PRINT "Thank you!": EXIT DO
  CASE "N": PRINT "Too bad!!": EXIT DO
LOOP

' Waits for the user to press a key
DQBwaitKey KEYANY

' Removes the keyboard handler
DQBremoveKeyboard

' Ends program
DQBclose

*****************************************************************************