[Gambas-user] What is the Gambas equivalent of Inkey ?

Lewis Balentine lewis at ...3412...
Sat Dec 6 17:04:06 CET 2014


For a console application I want to issue a prompt:
"Press any key to continue ..."
or
"Press 'X' to exit or 'C' to continue:"
and then wait for the user to press a key.

I can find no equivalent for the Basic "inkey" function. I have tried 
using wait/read but it seems one must press the "enter" key.
Private Function InKey(Prompt As String) As Byte
   Dim n As Byte
   If Prompt <> "" Then Print Prompt
   n = 0
   While n = 0
     Wait 0.01
     ' n = Read As Byte
     n = Read 1
   Wend
   Return n
End

Suggestions ?

Lewis






More information about the User mailing list