REM Code posted by OldosloverDEFINT A-Z 'make all variables integersSCREEN 12 '640 x 480 pixel at 16 colorsSelectionArea$ = STRING$(20, 220) 'create 20 characters of a square into a stringDone = 0 'our master exit variableOOption = 1 'our menu idenitifyerPRINT "Use the UP and DOWN arrow keys to move highlight bar up and down , enter key to select that selection"PRINT "Any key to contimue"Dummy$ = INPUT$(1) 'wait for keypressCLS 'clear the screenGOSUB Drawmenu 'draw the menuGOSUB Highlight 'draw the highlightDO IF _KEYDOWN(20480) THEN 'down arrow key OOption = OOption + 1 'increment selection variable IF OOption = 7 THEN OOption = 1 'if variable at end of list wrap it around to start of list CLS GOSUB Drawmenu GOSUB Highlight _DELAY .5 'delay to stop too fast movement END IF IF _KEYDOWN(18432) THEN 'up arrow key OOption = OOption - 1 IF OOption = 0 THEN OOption = 6 CLS GOSUB Drawmenu GOSUB Highlight _DELAY .5 END IF IF _KEYDOWN(13) THEN 'enter key LOCATE 28, 20: PRINT "Now going to MENU "; OOption Done = 1 'toggle exit variable END IFLOOP WHILE Done = 0SLEEPSYSTEM'------------------------Drawmenu:menuid = 1FOR t = 10 TO 20 STEP 2 LOCATE t, 30: PRINT menuid menuid = menuid + 1NEXT tRETURNHighlight:SELECT CASE OOption CASE 1 LOCATE 10, 32: PRINT SelectionArea$ CASE 2 LOCATE 12, 32: PRINT SelectionArea$ CASE 3 LOCATE 14, 32: PRINT SelectionArea$ CASE 4 LOCATE 16, 32: PRINT SelectionArea$ CASE 5 LOCATE 18, 32: PRINT SelectionArea$ CASE 6 LOCATE 20, 32: PRINT SelectionArea$END SELECTRETURN
DIM SHARED Llist$(10)DIM SHARED Sel AS INTEGERSCREEN 12FOR x = 1 TO 10 '---- Get the Menu List - Only needs done once READ Llist$(x)NEXT xMakeMenu '---- Show the Menu'----------------DO '--- Moving down Menu IF _KEYDOWN(20480) THEN COLOR 0, 7 ' --- Erase last move LOCATE Sel, 25: PRINT Llist$(Sel - 5) Sel = Sel + 1: IF Sel > 15 THEN Sel = 6 COLOR 0, 8 ' --- Show present move going down LOCATE Sel, 25: PRINT Llist$(Sel - 5) END IF ' --- Moving up the Menu IF _KEYDOWN(18432) THEN COLOR 0, 7 ' --- Erase last move LOCATE Sel, 25: PRINT Llist$(Sel - 5) Sel = Sel - 1: IF Sel < 6 THEN Sel = 15 COLOR 0, 8 ' --- Show present move going up the Menu LOCATE Sel, 25: PRINT Llist$(Sel - 5) END IF a$ = INKEY$ IF a$ = CHR$(13) THEN '--- press ENTER to select Selection Sel ' --- Goto Selected item END IF IF LCASE$(a$) = "q" THEN EXIT DO ' --- end Program _DISPLAY _LIMIT 8 ' --- set speed of selecter, change if selecter goes to fast or slow. Large number = fasterLOOPSYSTEM'-------------- Change these suit your needs in the menu ----------------DATA "Math","Draw Circle","Draw Box","Enter Name","Paste","Clear","Cut","Find","New","Run"'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' _____________________ Sub Selection _________________________________SUB Selection (Sel)GotoRoutine = Sel - 5' NOTE: cases 1 to 3 are calling subs. I didn't use subs in Cases 4 to 10 ' You can choose to do it either way but subs seperate from the rest' so its easier to edit later on and makes the programs more clear.SELECT CASE GotoRoutine CASE 1 Math ' --- Call sub math CASE 2 DrawCircle ' --- Call sub DrawCircle CASE 3 Drawbox ' --- Call sub Drawbox CASE 4 COLOR 0, 7: CLS: LOCATE 10, 20 INPUT "What is your name?"; n$, LOCATE 12, 20: PRINT "Hello "; n$; " Press a key to go to menu" _DISPLAY SLEEP 'wait for keypress to leave sub DO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statement CASE 5 COLOR 0, 7: CLS: LOCATE 10, 20 PRINT "you selected Option 'PASTE', Press a key to go to menu"; _DISPLAY SLEEP 'wait for keypress to leave sub DO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statement CASE 6 COLOR 0, 7: CLS: LOCATE 10, 20 PRINT "you selected Option Clear, Press a key to go to menu"; _DISPLAY SLEEP 'wait for keypress to leave sub DO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statement CASE 7 COLOR 0, 7: CLS: LOCATE 10, 20 PRINT "you selected Option 'CUT', Press a key to go to menu"; _DISPLAY SLEEP 'wait for keypress to leave sub DO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statement CASE 8 COLOR 0, 7: CLS: LOCATE 10, 20 PRINT "you selected Option 'FIND', Press a key to go to menu"; _DISPLAY SLEEP 'wait for keypress to leave sub DO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statement CASE 9 COLOR 0, 7: CLS: LOCATE 10, 20 PRINT "you selected Option 'NEW', Press a key to go to menu"; _DISPLAY SLEEP 'wait for keypress to leave sub DO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statement CASE 10 COLOR 0, 7: CLS: LOCATE 10, 20 PRINT "you selected Option 'RUN', Press a key to go to menu"; _DISPLAY SLEEP 'wait for keypress to leave sub DO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statementEND SELECTMakeMenu '-------- Go back to the menuEND SUB' _______________________ Sub Draw Circle _________________________________SUB DrawCircleCOLOR 0, 7: CLS '------- Clear the screen of the menuCIRCLE (300, 100), 50, 4LOCATE 14, 20PRINT " we are drawing circles"LOCATE 16, 20PRINT " Press a key to go back to main menu"_DISPLAY ' -- show the circle and textSLEEP 'wait for keypress to leave subDO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statementEND SUB'_______________________ Sub Draw Box_________________________________SUB DrawboxCOLOR 0, 7: CLS ' ------- Clear the screen of the menuLINE (200, 100)-(400, 150), 4, BFLINE (200, 100)-(400, 150), 0, BLOCATE 14, 20PRINT " we are drawing boxes"LOCATE 16, 20PRINT " Press a key to go back to main menu"_DISPLAY ' --- show the box and textSLEEP 'wait for keypress to leave subDO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statementEND SUB'______________________ Sub Math _____________________________________SUB MathCOLOR 0, 7: CLS ' ------- Clear the screen of the menuLOCATE 10, 16PRINT " we are doing math now: 9 X 6 = 54"LOCATE 12, 10PRINT " Put your Multiplication tables in this Sub Routine 'Math'"LOCATE 16, 18PRINT "Press a key to go back to the main menu"_DISPLAY ' ------- Show the textSLEEPDO: LOOP UNTIL INKEY$ = "" ' clear the keyboard after SLEEP statementEND SUB'_________________ Sub Make the Menu ________________________SUB MakeMenuSel = 6 ' --- Start location for selecterCOLOR 0, 7: CLSFOR x = 5 TO 15 ' --- Print the Menu list LOCATE x, 25 PRINT Llist$(x - 5)NEXT xLOCATE 20, 10PRINT "Use up/Down arrow keys - Press Enter to make selection";LOCATE 22, 20: PRINT " Press q to exit";COLOR 0, 8: LOCATE Sel, 25PRINT Llist$(Sel - 5)_DISPLAYEND SUB