home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_BAS / MNUSYS22.ZIP / MNSDEMO.BAS < prev    next >
BASIC Source File  |  1994-01-13  |  9KB  |  246 lines

  1. 'Menusys Demonstration Program
  2. 'Version 2.2
  3. '(C) Copyright 1993, 1994 by Tim Gerchmez
  4. 'All Rights Reserved.
  5.  
  6. 'Demonstration of MENUSYS Menuing Library for PowerBASIC and
  7. 'MENULIB Collection of Support Routines.
  8.  
  9. $compile exe
  10. $link "menusys.pbu"
  11. $link "menulib.pbu"
  12. $float procedure
  13.  
  14. public mouse%, segment&        'Mouse Flag and Video Segment
  15. public msx%, msy%, lb%, rb%    'Mouse X and Y pos, Left/Right Buttons
  16. public topcount%, bottomcount% 'Top/Bottom Menu Counts
  17. public mainclr%, mainbckg%     '"Main" Screen Colors
  18. public clr%, bckg%             'Temporary (Current) Colors
  19. public clr1%, clr2%, clr3%     'Alternate Character Colors
  20. public bckg1%, bckg2%, bckg3%  'Alternate Background Colors
  21. public helpfn$, progname$      'Help File and Program Name
  22.                    'Help filename should contain path as
  23.                    'well as main filename.
  24.  
  25.  
  26. 'Check Mouse and Video
  27.  
  28. CALL mhardreset(ms%, nb%)
  29. IF ms% = 0 THEN mouse% = 0 ELSE mouse% = 1
  30. segment& = vidseg&
  31. IF segment& = &HB000 THEN
  32.     mainclr% = 7: mainbckg% = 0
  33.     clr1% = 0: clr2% = 15
  34.     clr3% = 0
  35.     bckg1% = 7: bckg2% = 7
  36.     bckg3% = 7
  37. ELSE
  38.     mainclr% = 15: mainbckg% = 1
  39.     clr1% = 0: clr2% = 15
  40.     clr3% = 8
  41.     bckg1% = 7: bckg2% = 7
  42.     bckg3% = 3
  43. END IF
  44.  
  45. topcount% = 8: bottomcount% = 16  'Number of TOP (bar) and
  46.                           'BOTTOM (box) menu items.
  47.  
  48. REDIM menu$(0 : topcount%, 1 : bottomcount%)
  49. REDIM help$(1 : topcount%, 1 : bottomcount%)
  50. REDIM menutype%(1 : topcount%, 1 : bottomcount%)
  51. REDIM menucount%(1 : topcount%)
  52.  
  53. RESTORE menudata
  54.  
  55. FOR t% = 1 TO topcount%
  56.     READ menu$(0, t%)
  57. NEXT t%
  58.  
  59. FOR t% = 1 TO topcount%
  60.     READ menucount%(t%)
  61.     FOR u% = 1 TO menucount%(t%)
  62.         READ menu$(t%, u%)
  63.     NEXT u%
  64. NEXT t%
  65.  
  66. FOR t% = 1 TO topcount%
  67.     FOR u% = 1 TO menucount%(t%)
  68.     READ help$(t%, u%)
  69.     NEXT u%
  70. NEXT t%
  71.  
  72. menutype%(2, 1) = 1
  73. menutype%(8, 4) = 2
  74. menutype%(8, 5) = 2
  75.  
  76. COLOR mainclr%, mainbckg%: CLS
  77. CALL printborder
  78. CALL printtitle(" DEMONSTRATION.BAS ", 2, 1)
  79. CALL vscrollbar(3, 80, 19)
  80. CALL hscrollbar(24, 2, 76)
  81. COLOR mainclr%, mainbckg%
  82. LOCATE 3, 29: PRINT "Menusys Demo Program"
  83. LOCATE 5, 2:  PRINT "Welcome to Menusys, a Text Mode GUI (Graphical User Interface) for"
  84. LOCATE 6, 2:  PRINT "PowerBASIC that provides a CUA-Compliant interface similar (but not"
  85. LOCATE 7, 2:  PRINT "identical) to that used by the MS-DOS Editor Program.  Also included"
  86. locate 8, 2:  print "is Menulib, a library of support routines for MENUSYS.  You may be"
  87. LOCATE 9, 2:  PRINT "surprised to discover that Menusys and Menulib were written ENTIRELY"
  88. LOCATE 10, 2: PRINT "in PowerBASIC Source Code -- ";CHR$(34); "No Assembly Required."; CHR$(34);" This makes it easy"
  89. LOCATE 11, 2: PRINT "for you to alter and modify the subprograms to fit your specific needs."
  90. LOCATE 13, 2: PRINT "This demo program uses colors and menu options similar to those used by a"
  91. LOCATE 14, 2: PRINT "certain competing BASIC compiler <grin>.  Most of the options are "; CHR$(34); "dummy"; CHR$(34);
  92. LOCATE 15, 2: PRINT "options -- I.E. they don't do anything.  Use the mouse or the ALT key to"
  93. LOCATE 16, 2: PRINT "select menu options.  Note: Menu selection Edit/Undo (2,1)  has been set to"
  94. LOCATE 17, 2: PRINT "unavailable status to demonstrate that this availability choice exists"
  95. LOCATE 18, 2: PRINT "in Menusys.  Also, selections Options/Syntax (8,4) and Options/Full (8,5) are"
  96. LOCATE 19, 2: PRINT "toggle-type options, and will be displayed with a bullet next to them when"
  97. LOCATE 20, 2: PRINT "toggled ON.  Press F8 to end this demonstration."
  98. CALL printtopmenu(menu$(), 0)
  99. REDIM msg$(3)
  100. msg$(1) = "   Menusys Test/Example Program"
  101. msg$(2) = " (C) Copyright 1993 by Tim Gerchmez"
  102. msg$(3) = "        All Rights Reserved."
  103. helpfn$ = "demohelp.hlp"
  104. progname$ = "Menusys Demo"
  105. CALL infobox(msg$())
  106.  
  107. repeatpoint:
  108.  
  109. hlp$ = "Press ALT-Letter or Select with Mouse -- F8 to End Demo Program."
  110. CALL printbottomhelp(hlp$)
  111.  
  112. mainprogramloop:
  113.  
  114. CALL screenedit(2, 79, 3, 23, ky$)
  115.  
  116. IF ky$ = CHR$(0) + CHR$(66) THEN
  117.     REDIM msg$(3)
  118.     msg$(1) = ""
  119.     msg$(2) = "   Exit to DOS ?   "
  120.     msg$(3) = ""
  121.     CALL choosebox(msg$(), choice%)
  122.     IF choice% THEN GOTO mainprogramloop
  123.     COLOR 7, 0: CLS : END
  124. END IF
  125.  
  126. IF mouse% THEN
  127.     CALL mcheck
  128.     IF lb% = 1 AND msy% = 1 THEN GOTO dothemenu
  129.     IF lb% = 1 AND msy% = 23 AND msx% = 80 THEN
  130.     CALL mscrollup(1, 3, 2, 23, 79, mainbckg% * 16 + mainclr%)
  131.     END IF
  132.     IF lb% = 1 AND msy% = 3 AND msx% = 80 THEN
  133.     CALL mscrolldown(1, 3, 2, 23, 79, mainbckg% * 16 + mainclr%)
  134.     END IF
  135. END IF
  136.  
  137. IF altkey% = 1 THEN GOTO dothemenu
  138.  
  139. GOTO mainprogramloop
  140.  
  141. dothemenu:
  142.  
  143. CALL MENUSYS(menu$(), help$(), menucount%(), menutype%(), topchoice%, bottomchoice%)
  144.  
  145.  
  146. IF bottomchoice% = 0 THEN
  147.     LOCATE 23, 2: COLOR mainclr%, mainbckg%
  148.     PRINT "ESC or Right Mouse Pressed.       "
  149.     GOTO repeatpoint
  150. END IF
  151.  
  152. COLOR mainclr%, mainbckg%
  153. LOCATE 22, 2: PRINT "Top Choice: "; topchoice%; "                     ";
  154. LOCATE 23, 2: PRINT "Bottom Choice: "; bottomchoice%; "                     ";
  155.  
  156. IF topchoice% = 8 THEN
  157.     IF bottomchoice% = 4 THEN
  158.         menutype%(8, 4) = menutype%(8, 4) + 1
  159.         IF menutype%(8, 4) = 4 THEN menutype%(8, 4) = 2
  160.     END IF
  161.     IF bottomchoice% = 5 THEN
  162.         menutype%(8, 5) = menutype%(8, 5) + 1
  163.         IF menutype%(8, 5) = 4 THEN menutype%(8, 5) = 2
  164.     END IF
  165. END IF
  166. GOTO repeatpoint
  167.  
  168. '*************************************************************************
  169. menudata:
  170.  
  171. '-----------------------------
  172. 'TOP MENU BAR SELECTION TITLES
  173. DATA "  (F)ile", "  (E)dit", "  (V)iew", " (S)earch", "  (R)un", " (D)ebug", " (C)alls", " (O)ptions"
  174.  
  175. '-----------------------------
  176. 'BOX MENU TITLES
  177. DATA 15,(N)ew Program, (O)pen Program, (M)erge..., Save, Save (A)s...
  178. DATA Sa(v)e All, "-", (C)reate File..., (L)oad File..., (U)nload File...
  179. DATA "-", (P)rint..., (D)OS Shell, "-", E(x)it
  180.  
  181. DATA 8, (U)ndo, (C)ut, C(o)py, (P)aste, C(l)ear, "-", New (S)ub..., New (F)unction
  182.  
  183. DATA 9, (S)ubs..., N(e)xt Sub, S(p)lit, "-", (N)ext Statement, O(u)tput Screen
  184. DATA "-", (I)ncluded File, Included (L)ines
  185.  
  186. DATA 5, (F)ind..., (S)elected Text, (R)epeat Last Find, (C)hange..., (L)abel...
  187.  
  188. DATA 9, (S)tart, (R)estart, Co(n)tinue, Modify (C)OMMAND$..., "-"
  189. DATA Make E(X)E File..., Make (L)ibrary..., "-", Set (M)ain Module...
  190.  
  191. DATA 13, (A)dd Watch..., (I)nstant Watch..., (W)atchpoint..., (D)elete Watch...
  192. DATA Delete (A)ll Watch, "-", (T)race On, (H)istory On, "-"
  193. DATA Toggle (B)reakpoint, (C)lear All Breakpoints, Break on (E)rrors, (S)et Next Statement
  194.  
  195. DATA 1, UNTITLED.BAS
  196.  
  197. DATA 5, (D)isplay, Set (P)aths..., Right (M)ouse..., (S)yntax Checking, (F)ull Menus
  198.  
  199. '-----------------------------
  200. 'BOX MENU HELP
  201.  
  202. DATA Removes currently loaded program from memory, Loads new program into memory
  203. DATA Inserts specified file into current module, Writes current module to file on disk
  204. DATA Saves current module with specified name and format, Writes all currently loaded modules to files on disk
  205. DATA "-", "Creates a module, include file, or document; retains loaded modules"
  206. DATA "Loads a module, include file, or document; retains loaded modules"
  207. DATA "Removes a loaded module, include file, or document from memory"
  208. DATA "-", Prints specified text or module, Temporarily suspends Qxxxxxxxxx and invokes DOS shell
  209. DATA "-", Exits Qxxxxxxxxx and returns to DOS
  210.  
  211. DATA Restores current edited line to its original condition, Deletes selected text and copies it to buffer
  212. DATA Copies selected text to buffer, Inserts buffer contents at current location
  213. DATA Deletes selected text without copying it to buffer, "-"
  214. DATA Opens a window for a new subprogram, Opens a window for a new FUNCTION procedure
  215.  
  216. DATA "Displays a loaded SUB, FUNCTION, module, include file, or document"
  217. DATA Displays next SUB or FUNCTION procedure in the active window
  218. DATA Divides screen into two View windows, "-"
  219. DATA Displays next statement to be executed, Displays output screen, "-"
  220. DATA Displays include file for editing, Displays include file for viewing only (not for editing)
  221.  
  222. DATA Finds specified text, Finds selected text, Finds next occurrence of text specified in previous search
  223. DATA Finds and changes specified text, Finds specified line label
  224.  
  225. DATA Runs current program, Clears variables in preparation for restarting single stepping
  226. DATA Continues execution after a break, Sets string returned by COMMAND$ function
  227. DATA "-", Creates executable file on disk, Creates Qxxxx library and stand-alone (.LIB) library on disk
  228. DATA "-", Makes the specified module the main module
  229.  
  230. DATA Adds specified expression to the Watch window, Displays the value of a variable or expression
  231. DATA Causes program to stop when specified expression is TRUE, Deletes specified entry from WATCH window
  232. DATA Deletes all Watch window entries, "-", Highlights statement currently executing
  233. DATA Records statement execution order, "-", Sets/clears breakpoint at cursor location
  234. DATA Removes all breakpoints, Stops execution at first statement in error handler
  235. DATA Indicates next statement to be executed
  236.  
  237. DATA "-"
  238.  
  239. DATA Changes display attributes, Sets default search paths, Changes action of right mouse click
  240. DATA Turns editor's syntax checking on or off, Toggles between Easy and Full Menu usage
  241.  
  242. '*************************************************************************
  243.  
  244. 'END MNS2DEMO.BAS
  245.  
  246.