home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_BAS
/
MNUSYS22.ZIP
/
MNSDEMO.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-01-13
|
9KB
|
246 lines
'Menusys Demonstration Program
'Version 2.2
'(C) Copyright 1993, 1994 by Tim Gerchmez
'All Rights Reserved.
'Demonstration of MENUSYS Menuing Library for PowerBASIC and
'MENULIB Collection of Support Routines.
$compile exe
$link "menusys.pbu"
$link "menulib.pbu"
$float procedure
public mouse%, segment& 'Mouse Flag and Video Segment
public msx%, msy%, lb%, rb% 'Mouse X and Y pos, Left/Right Buttons
public topcount%, bottomcount% 'Top/Bottom Menu Counts
public mainclr%, mainbckg% '"Main" Screen Colors
public clr%, bckg% 'Temporary (Current) Colors
public clr1%, clr2%, clr3% 'Alternate Character Colors
public bckg1%, bckg2%, bckg3% 'Alternate Background Colors
public helpfn$, progname$ 'Help File and Program Name
'Help filename should contain path as
'well as main filename.
'Check Mouse and Video
CALL mhardreset(ms%, nb%)
IF ms% = 0 THEN mouse% = 0 ELSE mouse% = 1
segment& = vidseg&
IF segment& = &HB000 THEN
mainclr% = 7: mainbckg% = 0
clr1% = 0: clr2% = 15
clr3% = 0
bckg1% = 7: bckg2% = 7
bckg3% = 7
ELSE
mainclr% = 15: mainbckg% = 1
clr1% = 0: clr2% = 15
clr3% = 8
bckg1% = 7: bckg2% = 7
bckg3% = 3
END IF
topcount% = 8: bottomcount% = 16 'Number of TOP (bar) and
'BOTTOM (box) menu items.
REDIM menu$(0 : topcount%, 1 : bottomcount%)
REDIM help$(1 : topcount%, 1 : bottomcount%)
REDIM menutype%(1 : topcount%, 1 : bottomcount%)
REDIM menucount%(1 : topcount%)
RESTORE menudata
FOR t% = 1 TO topcount%
READ menu$(0, t%)
NEXT t%
FOR t% = 1 TO topcount%
READ menucount%(t%)
FOR u% = 1 TO menucount%(t%)
READ menu$(t%, u%)
NEXT u%
NEXT t%
FOR t% = 1 TO topcount%
FOR u% = 1 TO menucount%(t%)
READ help$(t%, u%)
NEXT u%
NEXT t%
menutype%(2, 1) = 1
menutype%(8, 4) = 2
menutype%(8, 5) = 2
COLOR mainclr%, mainbckg%: CLS
CALL printborder
CALL printtitle(" DEMONSTRATION.BAS ", 2, 1)
CALL vscrollbar(3, 80, 19)
CALL hscrollbar(24, 2, 76)
COLOR mainclr%, mainbckg%
LOCATE 3, 29: PRINT "Menusys Demo Program"
LOCATE 5, 2: PRINT "Welcome to Menusys, a Text Mode GUI (Graphical User Interface) for"
LOCATE 6, 2: PRINT "PowerBASIC that provides a CUA-Compliant interface similar (but not"
LOCATE 7, 2: PRINT "identical) to that used by the MS-DOS Editor Program. Also included"
locate 8, 2: print "is Menulib, a library of support routines for MENUSYS. You may be"
LOCATE 9, 2: PRINT "surprised to discover that Menusys and Menulib were written ENTIRELY"
LOCATE 10, 2: PRINT "in PowerBASIC Source Code -- ";CHR$(34); "No Assembly Required."; CHR$(34);" This makes it easy"
LOCATE 11, 2: PRINT "for you to alter and modify the subprograms to fit your specific needs."
LOCATE 13, 2: PRINT "This demo program uses colors and menu options similar to those used by a"
LOCATE 14, 2: PRINT "certain competing BASIC compiler <grin>. Most of the options are "; CHR$(34); "dummy"; CHR$(34);
LOCATE 15, 2: PRINT "options -- I.E. they don't do anything. Use the mouse or the ALT key to"
LOCATE 16, 2: PRINT "select menu options. Note: Menu selection Edit/Undo (2,1) has been set to"
LOCATE 17, 2: PRINT "unavailable status to demonstrate that this availability choice exists"
LOCATE 18, 2: PRINT "in Menusys. Also, selections Options/Syntax (8,4) and Options/Full (8,5) are"
LOCATE 19, 2: PRINT "toggle-type options, and will be displayed with a bullet next to them when"
LOCATE 20, 2: PRINT "toggled ON. Press F8 to end this demonstration."
CALL printtopmenu(menu$(), 0)
REDIM msg$(3)
msg$(1) = " Menusys Test/Example Program"
msg$(2) = " (C) Copyright 1993 by Tim Gerchmez"
msg$(3) = " All Rights Reserved."
helpfn$ = "demohelp.hlp"
progname$ = "Menusys Demo"
CALL infobox(msg$())
repeatpoint:
hlp$ = "Press ALT-Letter or Select with Mouse -- F8 to End Demo Program."
CALL printbottomhelp(hlp$)
mainprogramloop:
CALL screenedit(2, 79, 3, 23, ky$)
IF ky$ = CHR$(0) + CHR$(66) THEN
REDIM msg$(3)
msg$(1) = ""
msg$(2) = " Exit to DOS ? "
msg$(3) = ""
CALL choosebox(msg$(), choice%)
IF choice% THEN GOTO mainprogramloop
COLOR 7, 0: CLS : END
END IF
IF mouse% THEN
CALL mcheck
IF lb% = 1 AND msy% = 1 THEN GOTO dothemenu
IF lb% = 1 AND msy% = 23 AND msx% = 80 THEN
CALL mscrollup(1, 3, 2, 23, 79, mainbckg% * 16 + mainclr%)
END IF
IF lb% = 1 AND msy% = 3 AND msx% = 80 THEN
CALL mscrolldown(1, 3, 2, 23, 79, mainbckg% * 16 + mainclr%)
END IF
END IF
IF altkey% = 1 THEN GOTO dothemenu
GOTO mainprogramloop
dothemenu:
CALL MENUSYS(menu$(), help$(), menucount%(), menutype%(), topchoice%, bottomchoice%)
IF bottomchoice% = 0 THEN
LOCATE 23, 2: COLOR mainclr%, mainbckg%
PRINT "ESC or Right Mouse Pressed. "
GOTO repeatpoint
END IF
COLOR mainclr%, mainbckg%
LOCATE 22, 2: PRINT "Top Choice: "; topchoice%; " ";
LOCATE 23, 2: PRINT "Bottom Choice: "; bottomchoice%; " ";
IF topchoice% = 8 THEN
IF bottomchoice% = 4 THEN
menutype%(8, 4) = menutype%(8, 4) + 1
IF menutype%(8, 4) = 4 THEN menutype%(8, 4) = 2
END IF
IF bottomchoice% = 5 THEN
menutype%(8, 5) = menutype%(8, 5) + 1
IF menutype%(8, 5) = 4 THEN menutype%(8, 5) = 2
END IF
END IF
GOTO repeatpoint
'*************************************************************************
menudata:
'-----------------------------
'TOP MENU BAR SELECTION TITLES
DATA " (F)ile", " (E)dit", " (V)iew", " (S)earch", " (R)un", " (D)ebug", " (C)alls", " (O)ptions"
'-----------------------------
'BOX MENU TITLES
DATA 15,(N)ew Program, (O)pen Program, (M)erge..., Save, Save (A)s...
DATA Sa(v)e All, "-", (C)reate File..., (L)oad File..., (U)nload File...
DATA "-", (P)rint..., (D)OS Shell, "-", E(x)it
DATA 8, (U)ndo, (C)ut, C(o)py, (P)aste, C(l)ear, "-", New (S)ub..., New (F)unction
DATA 9, (S)ubs..., N(e)xt Sub, S(p)lit, "-", (N)ext Statement, O(u)tput Screen
DATA "-", (I)ncluded File, Included (L)ines
DATA 5, (F)ind..., (S)elected Text, (R)epeat Last Find, (C)hange..., (L)abel...
DATA 9, (S)tart, (R)estart, Co(n)tinue, Modify (C)OMMAND$..., "-"
DATA Make E(X)E File..., Make (L)ibrary..., "-", Set (M)ain Module...
DATA 13, (A)dd Watch..., (I)nstant Watch..., (W)atchpoint..., (D)elete Watch...
DATA Delete (A)ll Watch, "-", (T)race On, (H)istory On, "-"
DATA Toggle (B)reakpoint, (C)lear All Breakpoints, Break on (E)rrors, (S)et Next Statement
DATA 1, UNTITLED.BAS
DATA 5, (D)isplay, Set (P)aths..., Right (M)ouse..., (S)yntax Checking, (F)ull Menus
'-----------------------------
'BOX MENU HELP
DATA Removes currently loaded program from memory, Loads new program into memory
DATA Inserts specified file into current module, Writes current module to file on disk
DATA Saves current module with specified name and format, Writes all currently loaded modules to files on disk
DATA "-", "Creates a module, include file, or document; retains loaded modules"
DATA "Loads a module, include file, or document; retains loaded modules"
DATA "Removes a loaded module, include file, or document from memory"
DATA "-", Prints specified text or module, Temporarily suspends Qxxxxxxxxx and invokes DOS shell
DATA "-", Exits Qxxxxxxxxx and returns to DOS
DATA Restores current edited line to its original condition, Deletes selected text and copies it to buffer
DATA Copies selected text to buffer, Inserts buffer contents at current location
DATA Deletes selected text without copying it to buffer, "-"
DATA Opens a window for a new subprogram, Opens a window for a new FUNCTION procedure
DATA "Displays a loaded SUB, FUNCTION, module, include file, or document"
DATA Displays next SUB or FUNCTION procedure in the active window
DATA Divides screen into two View windows, "-"
DATA Displays next statement to be executed, Displays output screen, "-"
DATA Displays include file for editing, Displays include file for viewing only (not for editing)
DATA Finds specified text, Finds selected text, Finds next occurrence of text specified in previous search
DATA Finds and changes specified text, Finds specified line label
DATA Runs current program, Clears variables in preparation for restarting single stepping
DATA Continues execution after a break, Sets string returned by COMMAND$ function
DATA "-", Creates executable file on disk, Creates Qxxxx library and stand-alone (.LIB) library on disk
DATA "-", Makes the specified module the main module
DATA Adds specified expression to the Watch window, Displays the value of a variable or expression
DATA Causes program to stop when specified expression is TRUE, Deletes specified entry from WATCH window
DATA Deletes all Watch window entries, "-", Highlights statement currently executing
DATA Records statement execution order, "-", Sets/clears breakpoint at cursor location
DATA Removes all breakpoints, Stops execution at first statement in error handler
DATA Indicates next statement to be executed
DATA "-"
DATA Changes display attributes, Sets default search paths, Changes action of right mouse click
DATA Turns editor's syntax checking on or off, Toggles between Easy and Full Menu usage
'*************************************************************************
'END MNS2DEMO.BAS