home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
GLEN
/
TOPMENU2.ZIP
/
MENU2DMO.BAS
next >
Wrap
BASIC Source File
|
1989-12-07
|
25KB
|
755 lines
'========================================================================
' Documentation For:
' Top.Menu
' Version 2.0
'
' Written By: Glenn Miller (Not The Band Leader)
' Route 8 Box 492-A
' Asheboro, North Carolina 27203
'
' On: September 5, 1989
'
'
' This Program is " ShareWare " share it, abuse it, loose-it..etc...
'
' BUT!...If you can use it...please register it by sending $15.00
' to me at the address above. Happy Trails!
'
'========================================================================
'
'Top.Menu was created as an easy means to set up a menu operated system,
'without having to deal with passing "zillions" of varables to a subroutine.
'
'It is in NO way intended to replace any of the fine utilities available
'but to be considered as a simpler (and less definable) substitute.
'
'The following program "MENU2DMO" was written using Top.Menu so you can
'see how to setup your data for Top.Menu.
'
'Okay..Enough of that..Now on to this....
'
'
'As you can see in the DECLARE statement on the 1st line of this program there
'are only 11 varables that need to be passed to the subroutine..
'
'and here they are.....
'
'
' SEL Returns containing the number of the selection that was selected.
'
' SEL$ an arry of strings containing all the menu and submenu selections
' as well as the help line (line 25)
'
' FGC ......... Fore Ground Color of the Menus (0-15)
'
' BGC ......... Back Ground Color of the Menus (0-15)
'
' HLC ......... High Lite Color of the Menus (0-31)
'
' Top.Line .... The Top starting Row Location of the Menu (0-24)
'
' Dis.Time .... A switch to Turn the Time Display On (1=on)
' Time is displayed in a 12 hr format with Am/Pm
'
' Dis.Date .... A switch to Turn the Date Display On (1=on)
'
' Scn.Blank ... A switch to enable Automatic Screen Blanking (1=on)
' When enabled, the screen will turn off if no keys
' are pressed within 3 minutes.
'
' MSG$ ........ A string that will be centered on the Top Line of the Menu.
' If MSG$="" No Message is displayed on the top line.
'
' BGC$ ........ The character thats used to clear the screen. (0-255)
'
'
'
'Heres the Details..........
'
'This Menu system is a bar type with sub menus.
'There can be up to 9 selections per sub menu.
'There can be as many Selections on the Top Bar That you can fit on it
'and these DO NOT have to be the same length.
'
'
'The KEY to this menu system is the SEL$() array.
'
'This array should be dimensioned as DIM SEL$(x,10) in the start of your
'program, Where x=number of Top Bar Selections you will have.
'
'Array SEL$(x,0) needs to contain the Selection Names For the Top Bar.
'
'Arrays SEL$(x,1) thru SEL$(x,9) contain the Selection Names For the
'sub menu under the SEL$(x,0) Name.
'
'Array SEL$(x,10) needs to contain the HELP message that will be displayed
'on line 25. (if you want one.)
'
'
'Example: To Set up a Selection called "DOS" and have 3 sub selections
' called:
'
' Exit To Dos
' Shell To Dos
' Enter Dos Commands
'
' with a Help Message of: What Do You Want!
'
'The arrays would be:
'
' SEL$(0,0)=" Dos "
' SEL$(0,1)=" Exit To Dos "
' SEL$(0,2)=" Shell To Dos "
' SEL$(0,3)=" Enter Dos Commands "
' SEL$(0,4)=""
' SEL$(0,10)="What Do You Want!"
'
'
' !!!!! NOTICE !!!!!
'
' See How SEL$(0,4)=""
'
' You MUST always define the next array AFTER the last one you want
' to use as "" (Nul), UNLESS the last one is number 9....
'
' This makes it work right!..Okay..OK
'
'
'Define all the Selections you need by this method.
'Of course you will change to the next array..ie 1,2,3...etc. instead of 0.
'
'
'
'Running Top.Menu ........
'
'Once you have setup all the SEL$() your ready to go.
'
'The Top Bar Selections can be selected by 2 different ways.....
'
' 1 - Use The Left-Right cursor Keys to move to the desired selection.
' 2 - Press the Key of the 1st letter of a selection.
'
' Note: If more than one selection has the same starting letter the
' program will move to the next selection when that same letter
' key is pressed again. I call this a "round-robin" display but I
' really dont know why.
'
'
'The Sub selections can be selected 2 different ways...
'
' 1 - Use the Up-Down cursor keys to move to the desired selection and press
' the Enter Key.
' 2 - Enter the Number of the selection.(no enter key needed)
'
'
'
'
'What you get back for all your trouble........
'
'The SEL variable returns to you with a number containing the Selection that
'was selected. (wheeeee...)
'
' If the user pressed the "Esc" Key SEL will be -1. (neg.1)
' else heres what you get.
'
'
' The number is determined by: (Top Bar Selection Number *10) + selected sub#
'
'Example: If the user selected item# 5 from the first Top Bar selection the
' number would be: 5.
'
' First Top Bar number = 0 SEL$(0,x)
'
' 0 * 10 = 0 + 5 = 5
'
'
' If item# 5 was selected from the 5th Top Bar the number would be: 45
'
' 5th Top Bar Number = 4 SEL$(4,x)
'
' 4 * 10 = 40 + 5 = 45
'
'
'
' To include the Top.Menu routine Source Code in your Program;
'
' 1st - Create/Load YOUR program into Qbasic.
' 2nd - Select "Merge..." under the "File" selection of Qbasic.
' 3rd - Select "TOPMENU2.BAS" as the File Name To Be Merged.
'
' You should now be able to "View" Top.Menu by viewing the SUBs.
'
' Example: You can Try this using the "MENU2DMO.bas".
'
' 1.- Start Quickbasic
' 2.- Load in MENU2DMO.BAS (do not load the TOPMENU2.QLB library)
' 3.- Merge TOPMENU2.BAS
' 4.- The code is now included in MENU2DMO.BAS
' 5.- Select Top.Menu in "View" SUBs
'
'
'
' Thats about it for now....so....
' Waiter!.....TOP.MENU......please!
'========================================================================
DECLARE SUB Top.Menu (sel!, sel$(), fgc!, bgc!, hlc!, topline!, dis.time!, dis.date!, scn.blank!, msg$, bgc$)
DIM sel$(9, 10) 'remember this?
'=======================================================================
' * * * * * * * * DEFINE SEL$() ARRAY WITH MENU DATA * * * * * * * * * *
'=======================================================================
'=======================================================================
'Define Top Row Selection Names (x,0)
'=======================================================================
sel$(0, 0) = " Info "
sel$(1, 0) = " Change "
sel$(2, 0) = " Dos "
sel$(3, 0) = " Set Time "
sel$(4, 0) = " HELP! "
sel$(5, 0) = " Set Date "
sel$(6, 0) = " Quit "
sel$(7, 0) = " Directory "
sel$(8, 0) = " Files "
'=======================================================================
'Define Help Messages (x,10)
'=======================================================================
sel$(0, 10) = "Display Information About TOP.MENU"
sel$(1, 10) = "Make Changes In TOP.MENU's Subroutine Program Variables"
sel$(2, 10) = "Select The Dos Function You Want To Do"
sel$(3, 10) = "Press ENTER To Set Time"
sel$(4, 10) = "Press ENTER To Display Help"
sel$(5, 10) = "Press ENTER To Set Date"
sel$(6, 10) = "Press ENTER To Quit This Demo"
sel$(7, 10) = "Select The Directory To Be Displayed"
sel$(8, 10) = "Press ENTER To Display The Files and Description"
'=======================================================================
'Define Sub Selections For Top Selection 'INFO'
'=======================================================================
sel$(0, 1) = " About The Program "
sel$(0, 2) = " How Its Used "
sel$(0, 3) = " Its Heritage "
sel$(0, 4) = " HOW TO BUY IT! "
sel$(0, 5) = ""
'=======================================================================
'Define Sub Selections For Top Selection 'CHANGE'
'=======================================================================
sel$(1, 1) = " Back Ground Color...........(BGC) "
sel$(1, 2) = " Fore Ground Color...........(FGC) "
sel$(1, 3) = " High-Lite Color.............(HLC) "
sel$(1, 4) = " Back Ground Character......(BGC$) "
sel$(1, 5) = " Top Row Message............(MSG$) "
sel$(1, 6) = " Top Position of Menu....(TopLine) "
sel$(1, 7) = " Time Display on/off....(Dis.Time) "
sel$(1, 8) = " Date Display on/off....(Dis.Date) "
sel$(1, 9) = " Screen Blank on/off...(Scn.Blank) "
'=======================================================================
'Define Sub Selections For Top Selection 'DOS'
'=======================================================================
sel$(2, 1) = " Return To Dos "
sel$(2, 2) = " Shell To Dos "
sel$(2, 3) = " Show Dos Version "
sel$(2, 4) = " Enter a Dos Command "
sel$(2, 5) = ""
'=======================================================================
'No Sub Selections For Top Selection 3,4,5,6
'=======================================================================
sel$(3, 1) = ""
sel$(4, 1) = ""
sel$(5, 1) = ""
sel$(6, 1) = ""
'=======================================================================
'Define Sub Selections For Top Selection 'DIRECTORY'
'=======================================================================
sel$(7, 1) = " Display Directory For The Current Drive "
sel$(7, 2) = " Display Directory For Drive C:\ "
sel$(7, 3) = " Display Directory For Drive A:\ "
sel$(7, 4) = " Display Directory For Drive B:\ "
sel$(7, 5) = ""
'=======================================================================
'No Sub Selections For Top Selection 8 'FILES'
'=======================================================================
sel$(8, 1) = ""
'=======================================================================
'Define Top Row Message
'=======================================================================
msg$ = " TOP.MENU ShareWare V2.0 (c) Glenn Miller 1988,89 "
'=======================================================================
'Define Colors
'=======================================================================
fgc = 1 'fore ground color
bgc = 7 'back ground color
hlc = 15 'high lite color
'=======================================================================
'Set Location of Top of Menu to row 2 of the display
'=======================================================================
topline = 1
'=======================================================================
'Turn ON Time and Date Displays 1=on
'=======================================================================
dis.time = 1
dis.date = 1
'=======================================================================
'Turn OFF Automatic Screen Blanking 0=Off
'=======================================================================
scn.blank = 0
'=======================================================================
'Setup Back ground Character as # 177
'=======================================================================
bgc$ = CHR$(177)
'=======================================================================
'Make CALL to Top.Menu and wait for its return,
'comes back with selection# in SEL.
'=======================================================================
begin:
CALL Top.Menu(sel, sel$(), fgc, bgc, hlc, topline, dis.time, dis.date, scn.blank, msg$, bgc$)
'=======================================================================
' Do the desired Selection
' if its 'Esc' then loop to begin
' else do the desired function
'======================================================================='
'
IF sel = -1 THEN GOTO begin
SELECT CASE sel
CASE IS = 1
RESTORE About.pgm1
x = 8
GOSUB display.data
RESTORE About.pgm2
x = 8
GOSUB display.data
GOTO begin
CASE IS = 2
RESTORE how1
x = 9
GOSUB display.data
GOTO begin
CASE IS = 3
RESTORE her1
x = 10
GOSUB display.data
GOTO begin
CASE IS = 4
RESTORE buy1
x = 11
GOSUB display.data
GOTO begin
CASE IS = 11
RESTORE bgc1:
x = 18
GOSUB request
LOCATE 19, 45
PRINT bgc
LOCATE 21, 10
INPUT "--> ", a$
IF a$ = "" THEN GOTO begin
a = VAL(a$)
IF a < 0 OR a > 15 THEN GOTO begin
bgc = a
GOTO begin
CASE IS = 12
RESTORE fgc1:
x = 18
GOSUB request
LOCATE 19, 45
PRINT fgc
LOCATE 21, 10
INPUT "--> ", a$
IF a$ = "" THEN GOTO begin
a = VAL(a$)
IF a < 0 OR a > 15 THEN GOTO begin
fgc = a
GOTO begin
CASE IS = 13
RESTORE hlc1:
x = 18
GOSUB request
LOCATE 19, 45
PRINT hlc
LOCATE 21, 10
INPUT "--> ", a$
IF a$ = "" THEN GOTO begin
a = VAL(a$)
IF a < 0 OR a > 31 THEN GOTO begin
hlc = a
GOTO begin
CASE IS = 14
RESTORE back1:
x = 18
GOSUB request
LOCATE 19, 43
PRINT CHR$(34) + bgc$ + CHR$(34) + " Character #"; ASC(bgc$);
LOCATE 22, 10
INPUT "--> ", a$
IF a$ = "" THEN GOTO begin
a = VAL(a$)
IF a < 0 OR a > 255 THEN GOTO begin
bgc$ = CHR$(a)
GOTO begin
CASE IS = 15
RESTORE msg1:
x = 18
GOSUB request
LOCATE 20, 10
INPUT "--> ", msg$
GOTO begin
CASE IS = 16
RESTORE top1:
x = 18
GOSUB request
LOCATE 19, 45
PRINT topline
LOCATE 21, 10
INPUT "--> ", a$
IF a$ = "" THEN GOTO begin
a = VAL(a$)
IF a < 0 OR a > 9 THEN GOTO begin
topline = a
GOTO begin
CASE IS = 17
RESTORE time1:
x = 18
GOSUB request
LOCATE 19, 55
IF dis.time <> 0 THEN PRINT "OFF": dis.time = 0 ELSE PRINT "ON ": dis.time = 1
a$ = INPUT$(1)
GOTO begin
CASE IS = 18
RESTORE date1:
x = 18
GOSUB request
LOCATE 19, 55
IF dis.date <> 0 THEN PRINT "OFF": dis.date = 0 ELSE PRINT "ON ": dis.date = 1
a$ = INPUT$(1)
GOTO begin
CASE IS = 19
RESTORE blkscn1:
x = 17
GOSUB request
LOCATE 18, 59
IF scn.blank <> 0 THEN PRINT "OFF": scn.blank = 0 ELSE PRINT "ON ": scn.blank = 1
a$ = INPUT$(1)
GOTO begin
CASE IS = 21, 61
CLS
LOCATE 10, 25
PRINT "Thanks For Trying TOP.MENU !"
SYSTEM
CASE IS = 22, 24
COLOR 7, 0
CLS
LOCATE 1, 1
PRINT "Enter EXIT To Return To TOP.MENU Demo"
SHELL
GOTO begin
CASE IS = 23
COLOR 7, 0
CLS
LOCATE 10, 1
PRINT "You Current Operating System Is:"
SHELL "ver"
PRINT
PRINT "Press Any Key To Return To TOP.MENU...."
a$ = INPUT$(1)
GOTO begin
CASE IS = 31
COLOR 7, 0
CLS
LOCATE 10, 1
SHELL "time"
GOTO begin
CASE IS = 41
RESTORE how1
x = 9
GOSUB display.data
GOTO begin
CASE IS = 51
COLOR 7, 0
CLS
LOCATE 10, 1
SHELL "date"
GOTO begin
CASE IS = 71
COLOR 7, 0
CLS
SHELL "dir /p"
COLOR 31, 0
PRINT "Press any key..."
a$ = INPUT$(1)
GOTO begin
CASE IS = 72
COLOR 7, 0
CLS
SHELL "dir c:\*.* /p"
COLOR 31, 0
PRINT "Press any key..."
a$ = INPUT$(1)
GOTO begin
CASE IS = 73
COLOR 7, 0
CLS
SHELL "dir a:\*.* /p"
COLOR 31, 0
PRINT "Press any key..."
a$ = INPUT$(1)
GOTO begin
CASE IS = 74
COLOR 7, 0
CLS
SHELL "dir b:\*.* /p"
COLOR 31, 0
PRINT "Press any key..."
a$ = INPUT$(1)
GOTO begin
CASE IS = 81
RESTORE disfiles:
x = 9
GOSUB display.data
GOTO begin
CASE ELSE
GOTO begin
END SELECT
display.data:
p$ = " press a key "
GOTO dis2:
request: p$ = STRING$(13, "═")
dis2: READ a
LOCATE x, 8
COLOR hlc, fgc
PRINT CHR$(201) + STRING$(63, "═") + CHR$(187);
FOR i = x + 1 TO x + a
LOCATE i, 7
COLOR 0, 0
PRINT " ";
COLOR hlc, fgc
PRINT CHR$(186) + SPACE$(63) + CHR$(186);
NEXT
LOCATE i, 7
COLOR 0, 0
PRINT " ";
COLOR hlc, fgc
PRINT CHR$(200) + STRING$(2, "═") + p$ + STRING$(48, "═") + CHR$(188);
i = i + 1
LOCATE i, 7
COLOR 0, 0
PRINT SPACE$(65);
COLOR bgc, fgc
dis1: READ a$
IF a$ = "stop" THEN
IF p$ = STRING$(13, "═") THEN RETURN
a$ = INPUT$(1)
RETURN
END IF
x = x + 1
LOCATE x, 10
PRINT a$;
GOTO dis1
About.pgm1:
DATA 13
DATA "TOP.MENU is a routine to create a 'Fast' Menu System. Its"
DATA "designed to be used as a routine in YOUR Quick Basic 4.0 or"
DATA "later program. (This Demo was created around it.) It allows"
DATA "YOU to quickly and easily create a MENU driven program"
DATA "WITHOUT any of the hassle of designing it yourself, leaving"
DATA "YOU more time to work on the very thing you started writing"
DATA "your program for in the first place!"
DATA " >>>>> YOUR APPLICATION <<<<<"
DATA ""
DATA "TOP.MENU V2.0. is a complete Shareware version, nothing has
DATA "been left-out, no surprise messages will show up, and the"
DATA "program will not self-destruct in 30 days even if you don't"
DATA " >>>>> PAY FOR IT <<<<<"
DATA "stop"
About.pgm2:
DATA 13
DATA "TOP.MENU is written in 100% Qbasic. There are no special"
DATA "routines or machine calls used. The source code can be"
DATA "included in your code, and modified any way you want."
DATA "A 'CALL'to TOP.MENU will generate a Menu simiular to the"
DATA "one shown above. Its simple to interface to TOP.MENU. Your"
DATA "menu data is setup in an array, and passed to the routine."
DATA "Variables allow you to define colors, location, top line"
DATA "message, help messages, display date and/or time, and the"
DATA "character used as the background behind the menu. When a"
DATA "selection is made by the user, the routine returns with the"
DATA "number of that selection. The 'Change' selection above"
DATA "allows you to change the variables in this Demo so you"
DATA "can see what effect they have on the menu."
DATA "stop"
how1:
DATA 11
DATA "TOP.MENU is very 'User Friendly'. The Selections across the"
DATA "top display can be selected using the left/right cursor"
DATA "keys, or by pressing the key of the first letter of the"
DATA "desired selection. If theres more than one selection with"
DATA "the same starting letter, pressing the same letter again"
DATA "will move to the next selection."
DATA "The Sub selections can be selected by using the up/down"
DATA "cursor keys and pressing the ENTER key, or by pressing the
DATA "number key for the desired selection. If the number key is"
DATA "used, no ENTER key is necessary. This method allows almost"
DATA "any selection to be made with only a couple of key strokes."
DATA "stop"
her1:
DATA 11
DATA "TOP.MENU was created out of desperation (on my part) to solve"
DATA "a problem I was facing. Looking around at all the very fine"
DATA "utilites for Qbasic programmers, I was unable to find a"
DATA "simple to use menu system. I needed something that could run"
DATA "on any MS Dos machine without reguard for the type of display"
DATA "in use. 'Window' routines are nice but there was no way I"
DATA "could alter the source code to adjust it just the way I like"
DATA "it! Most other utilites required me to LINK with a HUGE"
DATA "library file just to get the few routines I wanted, making my"
DATA "program a MONSTER. TOP.MENU occupies less than 11,000 bytes"
DATA "when included in YOUR program. So, Waiter!..TOP.MENU...please!"
DATA "stop"
buy1:
DATA 10
DATA "TOP.MENU V2.0 is ShareWare. Please pass it along!. Take a few"
DATA "weeks or months to try it out. TRY IT IN YOUR PROGRAMS, see"
DATA "how it handles the 'turns', kick the tires, etc.. If you"
DATA "feel it is of use to you, then please register your copy"
DATA "by sending $15.00 (or whatever you think is fair) to:"
DATA ""
DATA " Glenn Miller * Route 8 Box 492-A * Asheboro, NC 27203"
DATA ""
DATA "If you have any questions/comments/etc., please feel free to"
DATA "contact me at the address above. Happy Trails.
DATA "stop"
bgc1:
DATA 3
DATA "Current Back Ground Color Number is"
DATA "Enter a NEW Color between 0 and 15, or ENTER for No Change."
DATA "stop"
fgc1:
DATA 3
DATA "Current Fore Ground Color Number is"
DATA "Enter a NEW Color between 0 and 15, or ENTER for No Change."
DATA "stop"
hlc1:
DATA 3
DATA "Current High Light Color Number is"
DATA "Enter a NEW Color between 0 and 31, or ENTER for No Change."
DATA "stop"
msg1:
DATA 2
DATA "Enter a NEW Top Line Message."
DATA "stop"
time1:
DATA 1
DATA " Press a Key To turn The TIME Display"
DATA "stop"
date1:
DATA 1
DATA " Press a Key To turn The DATE Display"
DATA "stop"
top1:
DATA 3
DATA "Current Top Position of the Menu is"
DATA "Enter a NEW Number between 0 and 9, or ENTER for No Change."
DATA "stop"
back1:
DATA 4
DATA "Current Back Ground Character is"
DATA "Enter a NEW Character Number, or ENTER for No Change."
DATA "May I suggest: 176-182, 219-255,"
DATA "stop"
blkscn1:
DATA 5
DATA " Press a Key To turn Automatic Screen Blanking "
DATA " When Screen Blanking is on, the display will turn off if"
DATA " no key is pressed within 3 minutes. To see this work, turn"
DATA " Screen Blanking ON, presss a key to return to the menu.."
DATA " Then set back a relax for 3 minutes.
DATA "stop"
disfiles:
DATA 11
DATA "MENU2DMO.EXE ...This Demo program"
DATA "MENU2DMO.BAS ...Source Code For MENU2DMO.EXE"
DATA "TOPMENU2.BAS ...Source Code For TOP.MENU subroutine"
DATA "TOPMENU2.QLB ...QuickBasic Library File of TOP.MENU"
DATA "TOPMENU2.LIB ...Linkable Library File of TOP.MENU"
DATA ""
DATA "The Documentation For TOP.MENU is located in the Beginning"
DATA "Comments of MENU2DMO.BAS"
DATA ""
DATA "If you 'share' this routine please make sure all of these"
DATA "Files are included."
DATA "stop"