SUB LiteMenu (M$(), NP, Choice, Row, Col, FGColr, BGColr, HILiteFG, HiLiteBG, ExitCode) ' +---------------------------------------------------------------------+ ' | - S U B L i t e M e n u - | ' | | ' | Public Domain - FreeWare | ' +---------------------------------------------------------------------+ ' | Author: Donald B. "Don" Smith | ' | Email : smithdonb@earthlink.net | ' | Date: 03/20/2002 | ' +---------------------------------------------------------------------+ ' | - ABOUT THE AUTHOR - | ' +---------------------------------------------------------------------+ ' | | ' | Hello. My name is Don Smith and I am a thirty-year retired teacher | ' | of Math/History/Spanish residing in Orange County, California. I | ' | am also a former six-year Sergeant of Marines. Who-Rah! On certain | ' | forums I am known as MarineDon. My email is: smithdonb@earthlink.net| ' | | ' +---------------------------------------------------------------------+ ' | - COPYING AND DISTIBUTING - | ' +---------------------------------------------------------------------+ ' | Since this code is public domain and freeware, anyone may freely | ' | copy and distribute it. If you use the QuickBasic code in one of | ' | your own programs, you do not have to cite my name as the author, | ' | and you may even change its name. | ' +---------------------------------------------------------------------+ ' +---------------------------------------------------------------------+ ' | The Lite Menu was written by Don Smith on 03-20-2002. The idea for | ' | the Lite Menu came while examining a bounce menu written by Frank | ' | R. Neal of Columbus, Ohio. If anyone is familiar with Frank's menu,| ' | they will see that the Lite Menu is totally different. I only used | ' | his idea to have a starting place. | ' +---------------------------------------------------------------------+ ' | | ' | M$............. The Menu items must be set in the main program | ' | and must be REDIMed. Example: REDIM M$(NP + 1)| ' | NP............. The number of menu choices | ' | Choice......... When the menu exits, it will report what number | ' | the Choice was. | ' | Row............ Row to place menu | ' | Col............ Column to place menu | ' | FGColr......... Foreground color | ' | BGColr......... Back ground color | ' | HiLiteFG....... Hi-light foreground color | ' | HiLiteBG....... Hi-light background color | ' | ExitCode....... Use ExitCode for key presses which are not part of | ' | the menu, like , , Letter , etc. | ' | F1 to F10 are 1 to 10. Other ExitCode numbers may | ' | be found by use the following short BASIC program: | ' +---------------------------------------------------------------------+ ' +---------------------------------------------------------------------+ ' | | ' | KeyCode.Bas - By Don Smith. FreeWare and Public Domain Program. | ' | (Date: 03-20-2002) | ' | COLOR 15, 1: CLS | ' | LOCATE 2, 14 | ' | PRINT "Press a key and the KeyCode% value will be displayed." | ' | LOCATE 4, 29 | ' | PRINT "(Press To Quit" | ' | PRINT : PRINT | ' | DO | ' | DO | ' | k$ = INKEY$ | ' | IF k$ = CHR$(27) THEN | ' | PRINT | ' | LOCATE , 10 | ' | PRINT STRING$(62, "-"): PRINT | ' | LOCATE , 34: PRINT "Program Ends": PRINT : PRINT | ' | END | ' | END IF | ' | | ' | LOOP UNTIL k$ <> "" | ' | KeyCode% = CVI(k$ + CHR$(0)) | ' | Key$ = STR$(KeyCode%) | ' | IF KeyCode% < 256 THEN | ' | LOCATE , 32, 0, 0, 0 | ' | PRINT k$ + " = " + Key$ | ' | ELSEIF KeyCode% > 255 THEN | ' | LOCATE , 21, 0, 0, 0 | ' | PRINT "Extended Key = " + Key$ | ' | END IF | ' | LOOP | ' | | ' +---------------------------------------------------------------------+ ' Row = Row - 3 ' COLOR FGColr, BGColr step1: step2: GOSUB step3 GOTO menu.end GOTO step2 step3: COLOR FGColr, BGColr FOR J = 1 TO 16 x$ = INKEY$ NEXT 'Choice = 1 LS = 2 FOR J = 1 TO NP IF LEN(M$(J)) > LS THEN LS = LEN(M$(J)) END IF NEXT ML$ = "##. \" + SPACE$(LS - 1) + "\" SL = Col FOR k = 1 TO NP LOCATE Row + 2 + k, SL PRINT USING ML$; k; M$(k) NEXT step4: LOCATE Row + 2 + Choice, SL COLOR HILiteFG, HiLiteBG PRINT USING ML$; Choice; M$(Choice); COLOR FGColr, BGColr TD = Choice step5: DO x$ = INKEY$ LOOP UNTIL LEN(x$) > 0 KP = CVI(x$ + CHR$(0)) IF KP = 27 THEN END END IF IF KP = 18432 THEN 'UpArrow IF Choice < 2 THEN Choice = NP ELSE Choice = Choice - 1 END IF END IF IF KP = 20480 THEN 'DnArrow Choice = Choice + 1 END IF IF Choice > NP THEN Choice = 1 END IF IF x$ >= "1" AND x$ <= "9" THEN IF VAL(x$) >= 1 AND VAL(x$) <= NP THEN Choice = VAL(x$) RETURN END IF END IF 'If F Keys or other extended keys are used, use the next 12 lines. 'Otherwise, REM them out to use less code. '+--------------------+ IF KP > 57 AND KP <> 18432 AND KP <> 20480 THEN '|traps above 9 and | IdentKey$ = STR$(((KP - 15104) \ 256) + 1) '|doesn't trap for  | IdentKey$ = LTRIM$(RTRIM$(IdentKey$)) '+--------------------+ ECode = VAL(IdentKey$) '+--------------------+ IF ECode > 0 AND ECode < 11 THEN '|F1-F10 are 1-10. For| ExitCode = ECode '|other extended keys,| EXIT SUB '|use the progam | END IF '|KeyCode.Bas which is| END IF '|shown above. | IF KP = 13 THEN '+--------------------+ EXIT SUB END IF IF KP = 27 THEN EXIT SUB END IF IF Choice = TD THEN GOTO step5 ELSE LOCATE Row + 2 + TD, SL PRINT USING ML$; TD; M$(TD) GOTO step4 END IF menu.end: END SUB