Additional to this.. If you want to inform the user where they are in the program and if/when there are multiple menus which menu they're using. You can put a menu 'name' in the "item$" and then don't test for it.
. . .
You will notice in the code here there is no test for m%=1
Code: Select all
TOP::
DO
CLS
m%=MENU("TOOLS,Files,Info,Comms,Mind,Off,Quit")
IF m%=0 OR m%=7 :RETURN
ELSEIF m%=2 :xpFILES:
ELSEIF m%=3 :xpINFO:
ELSEIF m%=4 :GOTO COMMS::
ELSEIF m%=5 :xpMM:
ELSEIF m%=6 :OFF
ENDIF
UNTIL m%=0
CM/XP
MENU
Syntax: m%=MENU(menu$)
Displays a menu of items. The string inside the brackets takes the form "item1,item2,item3...", and is displayed in the manner of the main menu. Allows a selection to be made from the menu in the usual way with cursor keys and EXE or the initial letter of the selected item, and returns the number of the item selected (1 to...). If ON/CLEAR is pressed, 0 is returned.
The menu items are displayed starting on the top line of the screen.
LZ/LZ64
MENUN
Syntax: m%=MENUN(n%,menuitem1,menuitem2...)
Displays a menu of items in the same way as MENU. However, the items are displayed differently according to the value of n%:
n%=0 Exactly the same as MENU
n%=1 Displays a one-line menu
n%=2 Displays a multi-line menu starting on the line with the current cursor position. Any text already display on the line above the cursor remains on the screen.