home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / BASIC / MNUSYS11 / MNSSHELL.BAS < prev    next >
BASIC Source File  |  1993-09-24  |  4KB  |  145 lines

  1. 'Menusys / Menulib Shell
  2. 'PowerBASIC Version
  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 mouse%, segment&        'Mouse Flag and Video Segment
  29. public msx%, msy%, lb%, rb%    'Mouse X and Y pos, Left/Right Buttons
  30. public topcount%, bottomcount% 'Top/Bottom Menu Counts
  31. public mainclr%, mainbckg%     '"Main" Screen Colors
  32. public clr%, bckg%             'Temporary (Current) Colors
  33. public clr1%, clr2%, clr3%     'Alternate Character Colors
  34. public bckg1%, bckg2%, bckg3%  'Alternate Background Colors
  35. public helpfn$, progname$      'Help File and Program Name
  36.                    'Help filename should contain path as
  37.                    'well as main filename.  Leave helpfn$
  38.                    'undefined for no help.
  39.  
  40. '---------------------
  41. 'Check Mouse and Video -
  42. 'This sets the PUBLIC
  43. 'variables declared
  44. 'in the last section to
  45. 'specific values.
  46. '---------------------
  47.  
  48. CALL mhardreset(ms%, nb%)
  49. IF ms% = 0 THEN mouse% = 0 ELSE mouse% = 1
  50. segment& = vidseg&
  51. IF segment& = &HB000 THEN
  52.     mainclr% = 7: mainbckg% = 0
  53.     clr1% = 0: clr2% = 15
  54.     clr3% = 0
  55.     bckg1% = 7: bckg2% = 7
  56.     bckg3% = 7
  57. ELSE
  58.     mainclr% = 15: mainbckg% = 1
  59.     clr1% = 0: clr2% = 15
  60.     clr3% = 8
  61.     bckg1% = 7: bckg2% = 7
  62.     bckg3% = 3
  63. END IF
  64.  
  65.  
  66. '--------------
  67. 'Read Menu Data
  68. '--------------
  69.  
  70. topcount% = 2: bottomcount% = 2  'Number of TOP (bar) and
  71.                  'BOTTOM (box) menus.
  72.  
  73. REDIM menu$(0 : topcount%, 1 : bottomcount%)
  74. REDIM help$(1 : topcount%, 1 : bottomcount%)
  75. REDIM menutype%(1 : topcount%, 1 : bottomcount%)
  76. REDIM menucount%(1 : topcount%)
  77.  
  78. RESTORE menudatapoint
  79.  
  80. FOR t% = 1 TO topcount%
  81.     READ menu$(0, t%)
  82. NEXT t%
  83.  
  84. FOR t% = 1 TO topcount%
  85.     READ menucount%(t%)
  86.     FOR u% = 1 TO menucount%(t%)
  87.         READ menu$(t%, u%)
  88.     NEXT u%
  89. NEXT t%
  90.  
  91. FOR t% = 1 TO topcount%
  92.     FOR u% = 1 TO menucount%(t%)
  93.     READ help$(t%, u%)
  94.     NEXT u%
  95. NEXT t%
  96.  
  97.  
  98. '---------------------------------
  99. 'Substitute the following with
  100. 'your own program.
  101. '---------------------------------
  102.  
  103. color mainclr%, mainbckg%  'Main Screen Colors
  104. cls
  105. CALL MENUSYS(menu$(), help$(), menucount%(), menutype%(), topchoice%, bottomchoice%)
  106. locate 10,1
  107. print "Top Menu: ";topchoice%
  108. print "Bottom Menu: ";bottomchoice%
  109. END
  110.  
  111.  
  112. '---------------------
  113. 'Menu Data Starts Here
  114. '---------------------
  115.  
  116. menudatapoint:
  117.  
  118. '--------------------------------------------
  119. 'TOP MENU BAR SELECTION TITLES (Enclose The
  120. 'Hot-Key Letter to Highlight in Parentheses).
  121. 'Set topcount% to number of top menu entries
  122. 'before reading (2 entries, in this case.)
  123.  
  124. DATA "  (F)ile", "  (E)dit"
  125.  
  126. '--------------------------------------------
  127. 'BOX MENU TITLES (For each box menu: Number of Entries
  128. 'followed by the text for the entries.  Use "-" for horiz.
  129. 'line.  Set bottomcount% to MAXIMUM number of bottom menu
  130. 'entries (should be >= topcount% - quirk of the program).
  131. 'bottomcount% = 3, in this case.
  132.  
  133. DATA 3,(N)ew Program, "-", (O)pen Program
  134. DATA 2, (U)ndo, (C)ut
  135.  
  136. '--------------------------------------------
  137. 'BOX MENU HELP
  138. 'Must correspond to (be in the same order and
  139. 'the same quantity as) the Box Menu Titles, including
  140. 'the "-" corresponding to the "-" entries in the box
  141. 'menu titles.
  142.  
  143. DATA Removes currently loaded program from memory, "-", Loads new program into memory
  144. DATA Restores current edited line to its original condition, Deletes selected text and copies it to buffer
  145.