Qbasicnews.com

QBasic => QB Discussion & Programming Help => Topic started by: johnfin on November 10, 2008, 11:01:52 AM



Title: input without return
Post by: johnfin on November 10, 2008, 11:01:52 AM
How can I write an input statement for a selection menu in a program that does not require a return key input from the user.


Title: Re: input without return
Post by: roy on November 10, 2008, 01:52:28 PM
INKEY$


Title: Re: input without return
Post by: Clippy on November 10, 2008, 07:23:38 PM
Use an INKEY$ loop and assign the keypress to a string variable.
Code:
DO: K$ = UCASE$(INKEY$)  'use uppercase letters if alphabetical 'main loop

' menu code goes here...........

LOOP UNTIL K$ = CHR$(27)  'escape program loop

SYSTEM 'closes program

For numerical menues, just use the string number instead of letters.

Ted