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

  1. 'Menusys / Menulib Shell
  2. 'Version 2.1
  3. '(C) Copyright 1993 by Tim Gerchmez
  4. 'All Rights Reserved.
  5.  
  6. 'Use this program as a shell for writing your
  7. 'own programs that incorporate Menusys and Menulib
  8. 'routines.  It should be compilable as-is, however,
  9. 'providing limited functionality as a demonstration.
  10.  
  11. '---------------------
  12. 'Tell PB to link in
  13. 'necessary routines
  14. '---------------------
  15.  
  16. $compile exe
  17. $link "menusys.pbu"
  18. $link "menulib.pbu"
  19.  
  20.  
  21. '----------------------------
  22. 'Declare Public Variables for
  23. 'MENUSYS and MENULIB - include
  24. 'in ALL programs that use
  25. 'Menusys/Menulib routines.
  26. '----------------------------
  27.  
  28. public scrnbuf?(min,2)         'New for V2.0
  29. public explode%, flash%        'New - Exploding Boxes and Flashing Selections
  30. public mouse%, segment&        'Mouse Flag and Video Segment
  31. public msx%, msy%, lb%, rb%    'Mouse X and Y pos, Left/Right Buttons
  32. public topcount%, bottomcount% 'Top/Bottom Menu Counts
  33. public mainclr%, mainbckg%     '"Main" Screen Colors
  34. public clr%, bckg%             'Temporary (Current) Colors
  35. public clr1%, clr2%, clr3%     'Alternate Character Colors
  36. public bckg1%, bckg2%, bckg3%  'Alternate Background Colors
  37. public helpfn$, progname$      'Help File and Program Name
  38.                    'Help filename should contain path as
  39.                    'well as main filename.  Leave helpfn$
  40.                    'undefined for no help.
  41.  
  42. '---------------------
  43. 'Check Mouse and Video -
  44. 'This sets the PUBLIC
  45. 'variables declared
  46. 'in the last section to
  47. 'specific values.
  48. '---------------------
  49.  
  50. DIM scrnbuf?(1:4096,0:3)   'New for V2.0 - Buffer for
  51.                            'Screen Data - Required!
  52.                '2nd dimension (0:3) can be
  53.                            'set as high as desired to
  54.                            'store more screens, as long
  55.                            'as memory is available, but
  56.                            '0:3 is the minimum.  4K used
  57.                            'for each increment of subscript.
  58.  
  59. CALL mhardreset(ms%, nb%)
  60. IF ms% = 0 THEN mouse% = 0 ELSE mouse% = 1
  61. segment& = vidseg&
  62. IF segment& = &HB000 THEN
  63.     mainclr% = 7: mainbckg% = 0
  64.     clr1% = 0: clr2% = 15
  65.     clr3% = 0
  66.     bckg1% = 7: bckg2% = 7
  67.     bckg3% = 7
  68. ELSE
  69.     mainclr% = 15: mainbckg% = 1
  70.     clr1% = 0: clr2% = 15
  71.     clr3% = 8
  72.     bckg1% = 7: bckg2% = 7
  73.     bckg3% = 3
  74. END IF
  75.  
  76.  
  77. '--------------
  78. 'Read Menu Data
  79. '--------------
  80.  
  81. topcount% = 2: bottomcount% = 2  'Number of TOP (bar) and
  82.                  'BOTTOM (box) menus.
  83.  
  84. REDIM menu$(0 : topcount%, 1 : bottomcount%)
  85. REDIM help$(1 : topcount%, 1 : bottomcount%)
  86. REDIM menutype%(1 : topcount%, 1 : bottomcount%)
  87. REDIM menucount%(1 : topcount%)
  88.  
  89. RESTORE menudatapoint
  90.  
  91. FOR t% = 1 TO topcount%
  92.     READ menu$(0, t%)
  93. NEXT t%
  94.  
  95. FOR t% = 1 TO topcount%
  96.     READ menucount%(t%)
  97.     FOR u% = 1 TO menucount%(t%)
  98.         READ menu$(t%, u%)
  99.     NEXT u%
  100. NEXT t%
  101.  
  102. FOR t% = 1 TO topcount%
  103.     FOR u% = 1 TO menucount%(t%)
  104.     READ help$(t%, u%)
  105.     NEXT u%
  106. NEXT t%
  107.  
  108.  
  109. '---------------------------------
  110. 'Substitute the following with
  111. 'your own program.
  112. '---------------------------------
  113.  
  114. color mainclr%, mainbckg%  'Main Screen Colors
  115. cls
  116. CALL MENUSYS(menu$(), help$(), menucount%(), menutype%(), topchoice%, bottomchoice%)
  117. locate 10,1
  118. print "Top Menu: ";topchoice%
  119. print "Bottom Menu: ";bottomchoice%
  120. END
  121.  
  122.  
  123. '---------------------
  124. 'Menu Data Starts Here
  125. '---------------------
  126.  
  127. menudatapoint:
  128.  
  129. '--------------------------------------------
  130. 'TOP MENU BAR SELECTION TITLES (Enclose The
  131. 'Hot-Key Letter to Highlight in Parentheses).
  132. 'Set topcount% to number of top menu entries
  133. 'before reading (2 entries, in this case.)
  134.  
  135. DATA "  (F)ile", "  (E)dit"
  136.  
  137. '--------------------------------------------
  138. 'BOX MENU TITLES (For each box menu: Number of Entries
  139. 'followed by the text for the entries.  Use "-" for horiz.
  140. 'line.  Set bottomcount% to MAXIMUM number of bottom menu
  141. 'entries (should be >= topcount% - quirk of the program).
  142. 'bottomcount% = 3, in this case.
  143.  
  144. DATA 3,(N)ew Program, "-", (O)pen Program
  145. DATA 2, (U)ndo, (C)ut
  146.  
  147. '--------------------------------------------
  148. 'BOX MENU HELP
  149. 'Must correspond to (be in the same order and
  150. 'the same quantity as) the Box Menu Titles, including
  151. 'the "-" corresponding to the "-" entries in the box
  152. 'menu titles.
  153.  
  154. DATA Removes currently loaded program from memory, "-", Loads new program into memory
  155. DATA Restores current edited line to its original condition, Deletes selected text and copies it to buffer
  156.