Prompting for menu keypresses

From BeebWiki
Revision as of 14:56, 30 November 2010 by Jgharston (talk) (Initial page.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Programs that prompt for a menu keypress often also allow the user to enter *commands. However, most of them either only allow one *command to be entered, or you are forced to return to the menu after entering a series of *commands. This can be annoying if, for example, you want to catalogue the disk to see what files are there, and then use the program's Load option to load a file. Returning to the menu means the catalogue disappears from the screen.

Using the following code allows a user to enter multiple *commands at the menu prompt, but also to enter menu keypresses keeping the screen output visible.

   REPEAT
     A$=GET$:IFA$="*":INPUTLINE"*"A$:OSCLIA$:PRINT":";:A$="*"
     A$=CHR$(ASCA$AND((A$<"a")OR&DF))
   UNTILINSTR("LSQ",A$):PRINTA$
   :
   IFA$="L":REM 'L' option
   IFA$="S":REM 'S' option
   IFA$="Q":REM 'Q' option
   etc.

If '*' is pressed, then the user is prompted to enter a *command, and then the prompt loops back to allow either more *commands or other menu options.

Jgharston 13:56, 30 November 2010 (UTC)