home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / basic / mnusys21 / mnsdemo.bas < prev    next >
Encoding:
BASIC Source File  |  1993-10-06  |  9.4 KB  |  253 lines

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