home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_BAS / MOSNHOS.ZIP / HOTSPOT.BAS < prev    next >
BASIC Source File  |  1994-01-15  |  5KB  |  182 lines

  1. DECLARE SUB Button1 ()
  2. DECLARE SUB CoolSpot (text$, row, col, attr)
  3. DECLARE SUB CursorChoice (shape)
  4. DECLARE SUB HotSpot (text$, row, col, attr)
  5. DECLARE SUB Mouse (ax%, bx%, cx%, dx%)
  6. DECLARE SUB MouseHide ()
  7. DECLARE SUB MousePaws (Squeeks)
  8. DECLARE SUB MouseQuit ()
  9. DECLARE SUB MouseStart ()
  10. DECLARE SUB MouseThere ()
  11. DECLARE SUB MouseSpeed (speed)
  12. DECLARE SUB QWK (text$, row, col, attr)
  13. DECLARE SUB Demo ()
  14.  
  15. ' $INCLUDE: 'C:\QB\QB.BI'
  16. ' Above statement vital to operation of program; path setting up to you
  17. LOCATE , , 0              'control hard cursor
  18. MouseQuit                 'erase cursor from any lingering mouse operations
  19. Mouse ax%, bx%, cx%, dx%  'call the mouse
  20. MouseThere                'check to see if mouse present
  21. MouseStart                'if present, start mouse operation
  22. MouseSpeed 15             'mouse movement setting
  23. CursorChoice 0            'select text cursor shape; 0 = default cursor
  24.  
  25. Demo                      ' call sub
  26.  
  27. SUB Button1
  28. ' Demonstration of passing mouse control from one sub to another
  29. QWK "╔" + STRING$(11, 205) + "╗", 5, 3, 78
  30. FOR x = 1 TO 8
  31. QWK "║" + SPACE$(11) + "║", x + 5, 3, 78
  32. QWK "╚" + STRING$(11, 205) + "╝", 13, 3, 78
  33. NEXT
  34. QWK "CLICK", 7, 5, 78
  35. QWK "ANYWHERE", 8, 5, 78
  36. QWK "INSIDE", 9, 5, 78
  37. QWK "THIS BOX", 10, 5, 78
  38. QWK "TO EXIT", 11, 5, 78
  39. DO
  40. Mouse 3, bx%, cx%, dx%          'tap into Mouse 3 function
  41. IF bx% > 0 THEN                 'button control
  42. column = cx% / 8 + 1            'column control
  43. row = dx% / 8 + 1               'row control
  44. END IF
  45. IF row > 5 AND row < 13 THEN    'control over a range of rows
  46. SELECT CASE column
  47. CASE 3 TO 15                    'control limited to cols 3 to 15
  48. Demo                            'call the sub
  49. END SELECT
  50. END IF
  51. LOOP UNTIL INKEY$ = CHR$(27)
  52. END SUB
  53.  
  54. SUB CoolSpot (text$, row, col, attr)
  55. QWK CHR$(17) + "■" + CHR$(16), row, col, 8
  56. MousePaws 15
  57. QWK CHR$(17) + "■" + CHR$(16), row, col, attr
  58. MousePaws 15
  59. END SUB
  60.  
  61. SUB CursorChoice (shape)
  62. SELECT CASE shape
  63. CASE 0: Mouse 10, 0, &H0, &H7700
  64. CASE 1: MouseChar = 4
  65. CASE 2: MouseChar = 8
  66. CASE 3: MouseChar = 15
  67. CASE 4: MouseChar = 23
  68. CASE 5: MouseChar = 24
  69. CASE 6: MouseChar = 25
  70. CASE 7: MouseChar = 26
  71. CASE 8: MouseChar = 27
  72. CASE 9: MouseChar = 35
  73. CASE 10: MouseChar = 36
  74. CASE 11: MouseChar = 48
  75. CASE 12: MouseChar = 63
  76. CASE 13: MouseChar = 88
  77. CASE 14: MouseChar = 178
  78. CASE 15: MouseChar = 197
  79. CASE 16: MouseChar = 220
  80. CASE 17: MouseChar = 237
  81. CASE 18: MouseChar = 239
  82. CASE 19: MouseChar = 251
  83. CASE 20: MouseChar = 254
  84. END SELECT
  85. dx% = &H7000 + MouseChar
  86. Mouse 10, 0, &H0, dx%
  87. END SUB
  88.  
  89. SUB Demo
  90. CLS
  91. MouseQuit                       'erase any lingering cursors
  92. QWK STRING$(2000, 0), 1, 1, 33  'window dressing
  93. QWK "╔" + STRING$(14, 205) + "╗", 5, 25, 120  'box around hotspot buttons
  94. FOR x = 1 TO 8
  95. QWK "║" + SPACE$(14) + "║", x + 5, 25, 120
  96. NEXT
  97. QWK "╚" + STRING$(14, 205) + "╝", 14, 25, 120
  98.  
  99. HotSpot "BUTTON 1", 7, 27, 31   'button settings
  100. HotSpot "EXIT    ", 11, 27, 31
  101. MouseStart                      'start mouse operations
  102. DO
  103. Mouse 3, bx%, cx%, dx%          'tap into Mouse 3 function
  104. IF bx% > 0 THEN                 'button control
  105. column = cx% / 8 + 1            'column control
  106. row = dx% / 8 + 1               'row control
  107. END IF
  108. SELECT CASE column
  109. CASE 27 TO 29
  110. IF row = 7 THEN CoolSpot "BUTTON 1", 7, 27, 78: Button1  'call a sub
  111. IF row = 11 THEN CoolSpot "EXIT", 11, 27, 78: END        'exit to SYSTEM
  112. END SELECT
  113. LOOP UNTIL INKEY$ = CHR$(27)    'escape route
  114. END SUB
  115.  
  116. SUB HotSpot (text$, row, col, attr)
  117. QWK CHR$(17) + "■" + CHR$(16), row, col, 78
  118. QWK SPACE$(1) + text$, row, col + 3, attr
  119. END SUB
  120.  
  121. SUB Mouse (ax%, bx%, cx%, dx%)
  122. DIM inregs AS RegType, outregs AS RegType
  123. inregs.ax = ax%
  124. inregs.bx = bx%
  125. inregs.cx = cx%
  126. inregs.dx = dx%
  127. INTERRUPT &H33, inregs, outregs
  128. ax% = outregs.ax
  129. bx% = outregs.bx
  130. cx% = outregs.cx
  131. dx% = outregs.dx
  132. END SUB
  133.  
  134. SUB MouseHide
  135. Mouse 2, bx%, cx%, dx%
  136. END SUB
  137.  
  138. SUB MousePaws (Squeeks)
  139. DEF SEG = 0
  140. FOR I = 1 TO Squeeks
  141. Now = PEEK(&H46C)
  142. DO: LOOP WHILE PEEK(&H46C) = Now
  143. NEXT
  144. END SUB
  145.  
  146. SUB MouseQuit
  147. Mouse 0, bx%, cx%, dx%
  148. END SUB
  149.  
  150. SUB MouseSpeed (speed)
  151. cx% = speed
  152. dx% = speed * 2
  153. Mouse 15, 0, cx%, dx%
  154. END SUB
  155.  
  156. SUB MouseStart
  157. Mouse 1, 0, 0, 0
  158. END SUB
  159.  
  160. SUB MouseThere
  161. ax% = 0
  162. Mouse ax%, bx%, cx%, dx%
  163. IF NOT ax% THEN
  164. CLS
  165. QWK " Mouse not installed -- Press any key to exit program ", 10, 15, 78
  166. WHILE INKEY$ = "": WEND
  167. SYSTEM
  168. END IF
  169. END SUB
  170.  
  171. SUB QWK (text$, row, col, attr)
  172. DIM ireg AS RegTypeX, oreg AS RegTypeX
  173. ireg.ax = &H1300
  174. ireg.bx = attr
  175. ireg.cx = LEN(text$)
  176. ireg.dx = (row - 1) * 256 + (col - 1)
  177. ireg.bp = SADD(text$)
  178. ireg.es = VARSEG(text$)
  179. INTERRUPTX &H10, ireg, oreg
  180. END SUB
  181.  
  182.