home *** CD-ROM | disk | FTP | other *** search
- '****************************************************************************
- 'Total Control Systems QuickBasic 4.5
- '****************************************************************************
- '
- ' Program : LMENU.BAS
- ' Written by : Tim Beck
- ' Written On : 10-01-90
- ' Function : LOTUS STYLE MENU (SIMILAR TO POPMENUH, LEVEL 1)
- '
- '****************************************************************************
- ' This program and those associated with it were written for use with Quick-
- ' Windows Advanced (Version 1.5+). Possesion of this program entitles you
- ' to certain priviliges. They are:
- '
- ' 1. You may compile, use, or modify this program in any way you choose
- ' provided you do not sell or give away the source code to this prog-
- ' ram or any of it's companions to anyone for any reason. You may,
- ' however, sell the resulting executable program as you see fit.
- '
- ' 2. You may modify, enhance or change these programs as you see fit. I
- ' as that you keep a copy of the original code and that you notify
- ' me of any improvements you make. I like to think that the code is
- ' bug free and cannot be improved upon, but I'm sure someone will
- ' find a way to make it better. If it's you, I'm looking forward to
- ' seeing your changes. I can be reached at:
- '
- ' Tim Beck Tim Beck (C/O Debbie Beck)
- ' 19419 Franz Road 8030 Fairchild Avenue
- ' Houston, Texas 77084 Canoga Park, California 91306
- ' (713) 639-3079 (818) 998-0588
- '
- ' 3. This code has been tested and re-tested in a variety of applications
- ' and although I have not found any bugs, doesn't mean none exist. So,
- ' this program along with it's companions comes with NO WARRANTY,
- ' either expressed or implied. I'm sorry if there are problems, but
- ' I can't be responsible for your work. I've tried to provide a safe
- ' and efficient programming enviroment and I hope you find it helpful
- ' for you. I do, however, need to cover my butt!
- '
- ' I have enjoyed creating this library of programs and have found them to be
- ' a great time saver. I hope you agree.
- '
- ' Tim Beck //
- '
- '****************************************************************************
- DECLARE SUB GET.INPUT (Row%, Col%, C.pos%, C.type%, AR.Flag%, C.Flag%, Blank%, I.Color%, Format$, Linp$, M.len%, E.Flag%, kb%)
- DECLARE SUB ONSCREEN (R%, C%, msg$, csr%, attr%)
-
- DECLARE SUB LOTUSMENU (Row%, Col%, M$(), H$(), M.Item%, Choice%)
-
- '-----------------------------------------------------------------------
- ' Lotus Style Menu
- '
- ' Row%, Col% = Top Left Row and Column of Menu
- ' M$() = Menu Selections
- ' H$() = Help Text for Each Menu Item
- ' M.Items% = Number of Menu Items
- ' Choice% = Selected Option
- '
-
-
- REM $INCLUDE: 'STDCOM.INC'
-
- TIMER OFF 'Enables Event Trapping
-
- ' ON ERROR GOTO ErrorTrap
-
- ErrorTrap:
-
- ' RESUME
-
- SUB LOTUSMENU (Row%, Col%, M$(), H$(), M.Item%, Choice%) STATIC
-
- COLOR M.Fore%, M.Back%
-
- x1% = Col%
- y1% = Row%
- MB.attr% = M.Back% + (16 * M.Fore%)
- MH.attr% = M.Fore% + 8 + (16 * M.Back%)
-
- Choices$ = ""
- max.wid% = 0
- M.Arrow% = 1
- IF Choice% < 1 OR Choice% > M.Item% THEN
- Choice% = 1
- END IF
-
- FOR Item% = 1 TO M.Item%
- IF LEN(M$(Item%)) > max.wid% THEN
- max.wid% = LEN(M$(Item%))
- END IF
- NEXT Item%
-
- FOR Item% = 1 TO M.Item%
- M$(Item%) = LEFT$(M$(Item%) + SPACE$(max.wid%), max.wid%)
- Choices$ = Choices$ + LEFT$(M$(Item%), 1)
- NEXT Item%
-
- IF Row% = 0 THEN
- Row% = 1
- END IF
-
- IF Col% = 0 THEN
- Col% = 1
- END IF
-
- 'Locate Row%, Col%
-
- FOR Item% = 1 TO M.Item%
- 'PRINT M$(Item%); " ";
- CALL PRINTA(Col% + ((Item% - 1) * (max.wid% + 1)), Row%, M.attr%, M$(Item%) + " ")
- NEXT Item%
-
- DO
- CALL ONSCREEN(Row% + 1, 2, H$(Choice%), 0, HB.attr%)
- CALL PRINTA(Col% + ((Choice% - 1) * (max.wid% + 1)), Row%, MB.attr%, M$(Choice%))
- COLOR M.Fore%, M.Back%
- LOCATE Row%, Col% + ((Choice% - 1) * (max.wid% + 1))
- IF LEN(Choices$) THEN
- M.Linp$ = MID$(Choices$, Choice%, 1)
- CALL GET.INPUT(Row%, Col% + ((Choice% - 1) * (max.wid% + 1)), 1, 0, 1, 1, 0, 1, CHR$(238), M.Linp$, 0, E.Flag%, kb%)
- ELSE
- M.Linp$ = MID$(Choices$, Choice%, 1)
- CALL GET.INPUT(Row%, Col% + ((Choice% - 1) * (max.wid% + 1)), 1, 0, 1, 1, 0, 1, "", M.Linp$, 0, 1, kb%)
- END IF
- CALL PRINTA(Col% + ((Choice% - 1) * (max.wid% + 1)), Row%, M.attr%, M$(Choice%))
- IF X% = F.10% THEN
- M.Linp$ = MID$(STR$(Choice%), 2)
- ELSEIF X% = Right.Arrow% THEN
- IF Choice% = M.Item% THEN
- Choice% = 1
- ELSE
- Choice% = Choice% + 1
- END IF
- ELSEIF X% = Left.Arrow% THEN
- IF Choice% = 1 THEN
- Choice% = M.Item%
- ELSE
- Choice% = Choice% - 1
- END IF
- ELSEIF E.Flag% OR X% = F.9% THEN
- EXIT DO
- ELSEIF LEN(RTRIM$(M.Linp$)) THEN
- IF INSTR(Choices$, M.Linp$) > 0 THEN
- Choice% = INSTR(Choices$, M.Linp$)
- M.Linp$ = MID$(STR$(Choice%), 2)
- END IF
- ELSEIF X% = Enter% OR X% = Down.Arrow% THEN
- M.Linp$ = MID$(STR$(Choice%), 2)
- END IF
- LOOP WHILE VAL(M.Linp$) = 0
-
- CALL PRINTA(Col% + ((Choice% - 1) * (max.wid% + 1)), Row%, MB.attr%, M$(Choice%))
-
- COLOR S.Fore%, S.Back%
- M.Arrow% = 0
-
- END SUB
-
-