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

  1. 'Menulib Demo Program
  2. 'Version 2.1
  3. '(C) Copyright 1993 by Tim Gerchmez
  4. 'All Rights Reserved.
  5.  
  6. 'Demonstrates some of the routines available
  7. 'in Menulib for Menusys.
  8.  
  9. 'Note: Color and Mouse Required
  10. 'for this Demo.
  11.  
  12. $compile exe
  13. $link "menusys.pbu"
  14. $link "menulib.pbu"
  15.  
  16. public scrnbuf?(min,2)         'New for V2.0
  17. public explode%, flash%        'New - Exploding Boxes & Flashing Selections
  18. public mouse%, segment&        'Mouse Flag and Video Segment
  19. public msx%, msy%, lb%, rb%    'Mouse X and Y pos, Left/Right Buttons
  20. public topcount%, bottomcount% 'Top/Bottom Menu Counts
  21. public mainclr%, mainbckg%     '"Main" Screen Colors
  22. public clr%, bckg%             'Temporary (Current) Colors
  23. public clr1%, clr2%, clr3%     'Alternate Character Colors
  24. public bckg1%, bckg2%, bckg3%  'Alternate Background Colors
  25. public helpfn$, progname$      'Help File and Program Name
  26.                    'Help filename should contain path as
  27.                    'well as main filename.
  28.  
  29. '------------------------------------------------------------------------------
  30.  
  31. DIM scrnbuf?(1:4096,0:3)  'New for V2.0 - Buffer for Screen Data-
  32.                           'Required!
  33.  
  34. mouse% = 1: segment& = &HB800
  35. mainclr% = 7: mainbckg% = 0
  36. clr1% = 0: bckg1% = 7
  37. bckg3% = bckg1%
  38. clr2% = mainclr%
  39. COLOR mainclr%, mainbckg%: CLS
  40. CALL mhardreset(a%, b%)
  41.  
  42. 'INFOBOX --------------------------------------------------------------------
  43.  
  44. REDIM msg$(9)
  45. msg$(1) = "            MenuLIB Test/Example Program"
  46. msg$(2) = "         (C) Copyright 1993 by Tim Gerchmez"
  47. msg$(3) = ""
  48. msg$(4) = "This program demonstrates some of the routines"
  49. msg$(5) = "that are available in MENULIB for Menusys."
  50. msg$(6) = ""
  51. msg$(7) = "This is one of the routines, called INFOBOX, which"
  52. msg$(8) = "displays information on the screen and waits for the"
  53. msg$(9) = "user to select OK or press ENTER or ESC."
  54. LOCATE 1, 1: PRINT "INFOBOX"
  55. call sounds(1)
  56. explode%=4 'Delay (1 = No Delay)
  57. CALL infobox(msg$())
  58. call sounds(2)
  59.  
  60. 'CHOOSEBOX ------------------------------------------------------------------
  61.  
  62. REDIM msg$(3)
  63. LOCATE 1, 1: PRINT "CHOOSEBOX"
  64. msg$(1) = "    Begin Program    "
  65. msg$(2) = ""
  66. msg$(3) = "    Are you sure ?   "
  67. CALL choosebox(msg$(), choice%)
  68. IF choice% THEN END
  69.  
  70.  
  71. 'YESNOBOX -------------------------------------------------------------------
  72.  
  73. LOCATE 1, 1: PRINT "YESNOBOX              "
  74. CALL yesnobox("Are you positive you want to start?", c%)
  75. IF c% <> 1 THEN END
  76.  
  77.  
  78. 'SELECTFORE SELECTBACK ------------------------------------------------------
  79.  
  80. LOCATE 1, 1: PRINT "SELECTFORE          "
  81. CALL selectfore(clr%)
  82. LOCATE 1, 1: PRINT "SELECTBACK       "
  83. CALL selectback(bckg%)
  84. mainclr% = clr%: mainbckg% = bckg%
  85. COLOR mainclr%, mainbckg%: CLS
  86.  
  87.  
  88. 'BACKGROUND -----------------------------------------------------------------
  89.  
  90. CALL background(1)
  91.  
  92.  
  93. 'PICKLIST -------------------------------------------------------------------
  94.  
  95. REDIM lst$(1 TO 50)
  96. FOR t% = 1 TO 50: lst$(t%) = "Choice Number" + STR$(t%)
  97. NEXT t%
  98. LOCATE 1, 1: PRINT "PICKLIST"
  99. locate 1,10
  100. CALL picklist(lst$(), ch%)
  101. a$ = "You Chose Number" + STR$(ch%)
  102. LOCATE 1, 1: PRINT "ALERTBOX"
  103. CALL alertbox(a$)
  104. ERASE lst$
  105. CLS
  106.  
  107. 'MARKLIST --------------------------------------------------------------------
  108.  
  109. REDIM lst$(1 : 50),mrk?(1 : 50)
  110. FOR t% = 1 TO 50: lst$(t%) = "Selection " + STR$(t%)
  111. NEXT t%
  112. LOCATE 1, 1: PRINT "MARKLIST"
  113. CALL marklist(lst$(), mrk?())
  114. ERASE lst$, mrk?
  115. CLS
  116.  
  117.  
  118. 'RADIOBOX -------------------------------------------------------------------
  119.  
  120. DIM optn$(1 TO 10)
  121. FOR t% = 1 TO 10: optn$(t%) = "Option" + STR$(t%)
  122. NEXT t%
  123. title$ = "Pick One"
  124. LOCATE 1, 1: PRINT "RADIOBOX              "
  125. locate 6, 28:CALL radiobox(title$, optn$(), ch%)
  126. a$ = "You Chose Number" + STR$(ch%)
  127. LOCATE 1, 1: PRINT "ALERTBOX          "
  128. CALL alertbox(a$)
  129. ERASE optn$
  130.  
  131.  
  132. 'MOUSEPICK ------------------------------------------------------------------
  133.  
  134. REDIM ypos%(5), xmin%(5), xmax%(5)
  135. FOR t% = 2 TO 6: ypos%(t%-1) = t% * 2: NEXT t%
  136. FOR t% = 1 TO 5: xmin%(t%) = 2: xmax%(t%) = 6: NEXT t%
  137. LOCATE 4, 1: FOR t% = 1 TO 5: PRINT " =====  "; t%: PRINT : NEXT t%
  138. LOCATE 1, 1: PRINT "MOUSEPICK     "
  139. LOCATE 15, 1: PRINT "Click on one of the five ===== bars"
  140. WHILE pick% = 0
  141.     IF INKEY$ = CHR$(27) THEN GOTO clickedpoint
  142.     CALL mousepick(ypos%(), xmin%(), xmax%(), pick%)
  143. WEND
  144. clickedpoint:
  145. a$ = "You clicked on #" + STR$(pick%)
  146. LOCATE 1, 1: PRINT "ALERTBOX          "
  147. CALL alertbox(a$)
  148. ERASE ypos%, xmin%, xmax%
  149. CLS
  150.  
  151.  
  152. 'MESSAGEBOX -----------------------------------------------------------------
  153.  
  154. REDIM msg$(5)
  155. title$ = "Choose a Text File to Display"
  156. msg$(1) = "Choose a file to display using the mouse"
  157. msg$(2) = "or keyboard.  Make sure the file chosen"
  158. msg$(3) = "is a pure text file!  Also, make sure"
  159. msg$(4) = "file is not too large, as it will be read"
  160. msg$(5) = "into memory all at once."
  161. LOCATE 1, 1: PRINT "MESSAGEBOX         "
  162. LOCATE 8, 35
  163. CALL messagebox(title$, msg$())
  164.  
  165.  
  166. 'CHOOSEDIR ------------------------------------------------------------------
  167.  
  168. LOCATE 1, 1: PRINT "CHOOSEDIR         "
  169. CALL choosedir("*.*", ch$, 1)
  170. IF ch$ = "" THEN
  171.     LOCATE 1, 1: PRINT "ALERTBOX           "
  172.     a$ = "No File Selected!": CALL alertbox(a$)
  173.     GOTO testcheckandpick
  174. END IF
  175.  
  176.  
  177. 'SHOWTEXTFILE ---------------------------------------------------------------
  178.  
  179. LOCATE 1, 1: PRINT "SHOWTEXTFILE         "
  180. CALL showtextfile(ch$, 15)
  181.  
  182.  
  183.  
  184. 'CHECKBOX -------------------------------------------------------------------
  185.  
  186. testcheckandpick:
  187. CLS
  188. REDIM mb$(5), help$(5), mb%(5)
  189. mb$(1) = "Selection One": mb$(2) = "Selection Two"
  190. mb$(3) = "Selection Three": mb$(4) = "Selection Four"
  191. mb$(5) = "Selection Five": title$ = "dfsklj"
  192. help$(1) = "     Use Cursor Keys or Mouse to select -- ESC or Right Button to Cancel."
  193. LOCATE 1, 1: PRINT "CHECKBOX"
  194. LOCATE 5, 5
  195. CALL checkbox(title$, mb$(), mb%())
  196.  
  197.  
  198. 'MENUPICK -------------------------------------------------------------------
  199.  
  200. LOCATE 1, 1: PRINT "MENUPICK             "
  201. locate 3,2
  202. CALL menupick(title$, mb$(), help$(), choice%)
  203. a$ = "You Chose Number" + STR$(choice%)
  204. LOCATE 1, 1: PRINT "ALERTBOX          "
  205. CALL alertbox(a$)
  206.  
  207.  
  208. 'INPBOX -------------------------------------------------------------------
  209. testinput:
  210.     LOCATE 1, 1: PRINT "INPBOX          "
  211.     ip$ = "*.*"
  212.     CALL inpbox("File to Load:", ip$, 12, 0, 255)
  213.  
  214.  
  215. 'ALERTBOX -------------------------------------------------------------------
  216.  
  217. testalert:
  218.     a$ = "You Chose " + ip$
  219.     IF ip$ = "" THEN a$ = "Command Cancelled"
  220.     LOCATE 1, 1: PRINT "ALERTBOX          "
  221.     CALL alertbox(a$)
  222.  
  223.