' +---------------------------------------------------------------------+ ' | | ' | - L i t e M e n u . B a s - | ' | | ' | | ' | Public Domain - FreeWare | ' +---------------------------------------------------------------------+ ' +---------------------------------------------------------------------+ ' | | ' | LiteMenu.Bas, written by Don Smith is: | ' | (1) PUBLIC DOMAIN | ' | (2) FREEWARE | ' | | ' +---------------------------------------------------------------------+ ' +---------------------------------------------------------------------+ ' | - ABOUT THE AUTHOR - | ' +---------------------------------------------------------------------+ ' | | ' | Hello. My name is Don Smith and I am a retired thiry-year teacher | ' | of Math/History/Spanish residing in Orange County, California. I am | ' | also a former 6-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. | ' +---------------------------------------------------------------------+ ' +---------------------------------------------------------------------+ ' | | ' | Compile: BC: BBmenuQB.Bas | ' | LINK: BBmenuQB.Bas | ' | LIB: BCom45.Lib | ' | | ' +---------------------------------------------------------------------+ DECLARE SUB LiteMenu (M$(), NP, Choice, Row, Col, FGColr, BGColr, HILiteFG, HiLiteBG, ExitCode) DECLARE SUB OneLine (LineRow%, LineCol%, LineFG%, LineBG%, Style%, LenStr%) DECLARE SUB TinyBox (ULRow, ULCol, LRRow, LRCol, BoxFGColr, BoxBGColr, SingOrDoub) begin: NP = 13 REDIM M$(NP + 1) M$(1) = "First" M$(2) = "Second" M$(3) = "Third" M$(4) = "Fourth" M$(5) = "Fifth" M$(6) = "Sixth" M$(7) = "Seventh" M$(8) = "Eighth" M$(9) = "Ninth" M$(10) = "Tenth" M$(11) = "Eleventh" M$(12) = "Twelve" M$(13) = "Thirteen" Choice = 1 control: COLOR 15, 1: CLS '----------------Setup for SUB TinyBox---------------- ULRow = 3: ULCol = 20: LRRow = 22: LRCol = 60 BoxFGColr = 15: BoxBGColr = 1: SingOrDoub = 2 CALL TinyBox(ULRow, ULCol, LRRow, LRCol, BoxFGColr, BoxBGColr, SingOrDoub) '----------------Setup for SUB OneLine---------------- LineRow% = 5: LineCol% = 20: LineFG% = 15 LineBG% = 1: Style% = 4: LenStr% = 40 CALL OneLine(LineRow%, LineCol%, LineFG%, LineBG%, Style%, LenStr%) '----------------Setup for SUB LiteMenu---------------- Row = 6: Col = 33: FGColr = 15: BGColr = 1 HILiteFG = 0: HiLiteBG = 7 LOCATE 4, 27: PRINT "Press <> <> or Any Key" CALL OneLine(20, 20, 15, 1, 4, 40) LOCATE 21, 31: PRINT "Press to exit" CALL LiteMenu(M$(), NP, Choice, Row, Col, FGColr, BGColr, HILiteFG, HiLiteBG, ExitCode) IF ExitCode = 27 THEN CLS : END ELSEIF ExitCode > 0 AND ExitCode < 11 THEN 'Example of to . COLOR 15, 5: CLS LOCATE 3, 26 PRINT "Yep! You Pressed " DO: LOOP WHILE INKEY$ = "" ExitCode = 0 GOTO control ELSE COLOR 15, 2: CLS SOUND 150, 2 LOCATE 8, 30 PRINT "Choice Was : #" + STR$(Choice) + " "; LOCATE 11, 30 PRINT "Press Any Key To Continue"; DO: LOOP WHILE INKEY$ = "" GOTO control END IF '+--------------------+ '|F1-F10 are 1-10. For| '|other extended keys,| '|use the progam | '|KeyCode.Bas which is| '|shown above. | '+--------------------+ SUB LiteMenu (M$(), NP, Choice, Row, Col, FGColr, BGColr, HILiteFG, HiLiteBG, ExitCode) ' +---------------------------------------------------------------------+ ' | 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 SUB OneLine (LineRow%, LineCol%, LineFG%, LineBG%, Style%, LenStr%) ' +-------------------------------------------------------------------+ ' | SUB OneLine | ' +-------------------------------------------------------------------+ ' | Not counting REM (') lines, SUB OneLine has 12 lines. | ' +-------------------------------------------------------------------+ ' | SUB OneLine will place one line on screen. There are 4 types | ' | of lines to choose from. See Style% below. | ' +---------------+---------------------------------------------------+ ' | LineRow% | Row to place line. | ' +---------------+---------------------------------------------------+ ' | LineCol% | Column to place line. | ' +---------------+---------------------------------------------------+ ' | LineFG% | Foreground color of line. | ' +---------------+---------------------------------------------------+ ' | LineBG% | Background color of line. | ' +---------------+---------------------------------------------------+ ' | Style% | Style% = 1 ÃÄÄÄ´ | ' | +---------------------------------------------------+ ' | | Style% = 2 ÆÍÍ͵ | ' | +---------------------------------------------------+ ' | | Style% = 3 ÌÍÍ͹ | ' | +---------------------------------------------------+ ' | | Style% = 4 ÇÄÄĶ | ' +---------------+---------------------------------------------------+ ' | LenStr% | Length of string (line). | ' +-------------------------------------------------------------------+ IF Style% = 1 THEN 'ÃÄÄÄ´ SingLine$ = CHR$(195) + STRING$(LenStr%, CHR$(196)) + CHR$(180) ELSEIF Style% = 2 THEN 'ÆÍÍ͵ SingLine$ = CHR$(198) + STRING$(LenStr%, CHR$(205)) + CHR$(181) ELSEIF Style% = 3 THEN 'ÌÍÍ͹ SingLine$ = CHR$(204) + STRING$(LenStr%, CHR$(205)) + CHR$(185) ELSEIF Style% = 4 THEN 'ÇÄÄĶ SingLine$ = CHR$(199) + STRING$(LenStr%, CHR$(196)) + CHR$(182) END IF LOCATE LineRow%, LineCol% COLOR LineFG%, LineBG% PRINT SingLine$; END SUB SUB TinyBox (ULRow, ULCol, LRRow, LRCol, BoxFGColr, BoxBGColr, SingOrDoub) ' +----------------------------------------------------------------------+ ' | SUB TinyBox | ' +----------------------------------------------------------------------+ ' | ULRow = Upper Left Row. ULCol = Upper Left Column. | ' | LRRow = Lower Right Row. LRCol = Lower Right Column. | ' | BoxFGColr = The Foreground Color The Box. | ' | BoxBGColr = The Back Ground Color Of The Box. | ' | SingOrDoub = 1 (Single Line Box). SingOrDoub = 2 (Double Line Box). | ' +----------------------------------------------------------------------+ COLOR BoxFGColr, BoxBGColr IF SingOrDoub = 1 THEN LOCATE ULRow, ULCol PRINT CHR$(218) + STRING$(LRCol - ULCol, CHR$(196)) + CHR$(191); FOR BoxY = ULRow + 1 TO LRRow - 1 LOCATE BoxY, ULCol PRINT CHR$(179) + STRING$(LRCol - ULCol, " ") + CHR$(179); NEXT LOCATE LRRow, ULCol PRINT CHR$(192) + STRING$(LRCol - ULCol, CHR$(196)) + CHR$(217); ELSEIF SingOrDoub = 2 THEN LOCATE ULRow, ULCol PRINT CHR$(201) + STRING$(LRCol - ULCol, CHR$(205)) + CHR$(187); FOR BoxY = ULRow + 1 TO LRRow - 1 LOCATE BoxY, ULCol PRINT CHR$(186) + STRING$(LRCol - ULCol, " ") + CHR$(186); NEXT LOCATE LRRow, ULCol PRINT CHR$(200) + STRING$(LRCol - ULCol, CHR$(205)) + CHR$(188); END IF END SUB