home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY5 / MICE.ZIP / MICE.DOC < prev    next >
Text File  |  1990-08-18  |  11KB  |  254 lines

  1. '  Contents of Mice.Obj
  2. '
  3. '    The following routines allow you to use a mouse with your PowerBasic
  4. '  programs.  You can use event trapping with a mouse if you follow these
  5. '  steps:
  6. '
  7. '    1.  The user Must press both the left and right mouse buttons.
  8. '    2.  Use the 'On Pen' and  'Pen On' statements to control
  9. '           the program flow when the user presses the buttons in step 1.
  10. '
  11. '  Perhaps some future release of PowerBasic will have an 'On Mouse'
  12. '  statement.
  13. '
  14. '  These routines are distributed AS IS.  By using the routines, you agree
  15. '  to accept full responsibility for any problems that may arise from said
  16. '  use.
  17. '
  18. '  These routines are copyright 1990.  All rights are reserved.  You may
  19. '  freely include and use these routines in your programs.  You may also
  20. '  freely distribute these routines, as long as this file accompanies the
  21. '  routines.
  22. '
  23. '  Have Fun,
  24. '
  25. '
  26. '  Brett Jones
  27. '  [76166,2542]  CompuServe
  28. '  B-Jones       Genie
  29.  
  30.  
  31.  
  32. '-----------------------------------------------------------------------------
  33. 'declare function IsMouse%()
  34. '-----------------------------------------------------------------------------
  35. '  IsMouse%  Returns either a 0 (no mouse installed) or the number of buttons
  36. '    available on the mouse.  If a mouse is installed, then the mouse pointer
  37. '    is reset to the middle of the screen, the display page is set to 0,
  38. '    the mouse pointer is hidden, user event handlers are disabled, light pen
  39. '    emulation is enabled, horizontal mickeys to pixels are set at 8 to 8,
  40. '    vertical mickeys to pixels are set to 16 to 8, double speed threshold is
  41. '    set to 64 mickeys/second, cursor defaults to block (text mode) or arrow
  42. '    (graphics mode) and the cursor limits are set to the entire screen.
  43. '-----------------------------------------------------------------------------
  44.  
  45.  
  46.  
  47. '-----------------------------------------------------------------------------
  48. 'declare sub ShowMouse()
  49. '-----------------------------------------------------------------------------
  50. '  ShowMouse  Allows the mouse cursor to be displayed
  51. '-----------------------------------------------------------------------------
  52.  
  53.  
  54.  
  55. '-----------------------------------------------------------------------------
  56. 'declare sub HideMouse()
  57. '-----------------------------------------------------------------------------
  58. '  HideMouse  Hides the mouse cursor.  Cursor movement tracking is continued
  59. '-----------------------------------------------------------------------------
  60.  
  61.  
  62.  
  63. '-----------------------------------------------------------------------------
  64. 'declare function WhereMouse&()
  65. '-----------------------------------------------------------------------------
  66. '  WhereMouse&  Returns a value from which you can determine the x and y
  67. '    coordinates (in pixels) of the mouse pointer.  Example:
  68. '
  69. '        b& = WhereMouse&
  70. '        x% = cint(b& mod 65536)
  71. '        y% = cint(b& / 65536)
  72. '
  73. '-----------------------------------------------------------------------------
  74.  
  75.  
  76.  
  77. '-----------------------------------------------------------------------------
  78. 'declare function MouseButtons%()
  79. '-----------------------------------------------------------------------------
  80. '  MouseButtons%  Returns the status of the mouse buttons.  If MouseButtons%
  81. '    equals 1, then the left button is down.  If it equals 2, then the right
  82. '    button is down.  If it equals 4, then the middle button is down.  The
  83. '    value returned can reflect buttons pressed simultaneously.
  84. '-----------------------------------------------------------------------------
  85.  
  86.  
  87.  
  88. '-----------------------------------------------------------------------------
  89. 'declare sub MoveMouse(integer,integer)
  90. '-----------------------------------------------------------------------------
  91. '  MoveMouse(x,y)  Moves the mouse cursor to horizontal (x) and vertical (y)
  92. '    pixel positions.  Displays the cursor unless the cursor is hidden, or the
  93. '    new position lies within an excluded area.
  94. '-----------------------------------------------------------------------------
  95.  
  96.  
  97.  
  98. '-----------------------------------------------------------------------------
  99. 'declare sub MouseWindow(integer,integer,integer,integer)
  100. '-----------------------------------------------------------------------------
  101. '  MouseWindow(x1,x2,y1,y2)  Sets the area in which the mouse cursor may be
  102. '    displayed.  X1 and X2 are the minimum and maximum horizontal pixel
  103. '    coordinates;  Y1 and Y2 are the minimum and maximum vertical pixel
  104. '    coordinates.  The cursor will be moved into the area if necessary.
  105. '-----------------------------------------------------------------------------
  106.  
  107.  
  108.  
  109. '-----------------------------------------------------------------------------
  110. 'declare function GetMickeys&()
  111. '-----------------------------------------------------------------------------
  112. '  GetMickeys&  Returns the number of mickeys since the last call to this
  113. '    function.  See a reference manual for more information on this function
  114. '    (Function 0BH, Interrupt 33H).
  115. '-----------------------------------------------------------------------------
  116.  
  117.  
  118.  
  119. '-----------------------------------------------------------------------------
  120. 'declare sub SetMickeys(integer,integer)
  121. '-----------------------------------------------------------------------------
  122. '  SetMickeys(x,y)  Allows you to set the mickey to pixel ratios.
  123. '-----------------------------------------------------------------------------
  124.  
  125.  
  126.  
  127. '-----------------------------------------------------------------------------
  128. 'declare sub ExcludeMouse(integer,integer,integer,integer)
  129. '-----------------------------------------------------------------------------
  130. '  ExcludeMouse(x1,y1,x2,y2)  Sets aside an area where the mouse cursor will
  131. '    not be displayed.  x1 is the upper left X pixel coordinate, y1 is the
  132. '    upper left Y coordinate, x2 is the lower right X coordinate and y2 is the
  133. '    lower right Y coordinate.
  134. '-----------------------------------------------------------------------------
  135.  
  136.  
  137.  
  138. '-----------------------------------------------------------------------------
  139. 'declare sub MouseSpeed(integer)
  140. '-----------------------------------------------------------------------------
  141. '  MouseSpeed(speed)  Sets the threshold speed for doubling pointer motion
  142. '    on the screen to the value specified in (speed).  The default is 64
  143. '    mickeys per second.
  144. '-----------------------------------------------------------------------------
  145.  
  146.  
  147.  
  148. '-----------------------------------------------------------------------------
  149. 'declare sub SaveMouse()
  150. '-----------------------------------------------------------------------------
  151. '  SaveMouse  Saves the mouse driver state.  This must be used before
  152. '    executing a child program (Dos EXEC function).  Use RestoreMouse on
  153. '    return.
  154. '-----------------------------------------------------------------------------
  155.  
  156.  
  157.  
  158. '-----------------------------------------------------------------------------
  159. 'declare sub RestoreMouse()
  160. '-----------------------------------------------------------------------------
  161. '  RestoreMouse  Restores the mouse to the values set by SaveMouse.
  162. '-----------------------------------------------------------------------------
  163.  
  164.  
  165.  
  166. '-----------------------------------------------------------------------------
  167. 'declare sub SetMouseSensitivity(integer,integer,integer)
  168. '-----------------------------------------------------------------------------
  169. '  SetMouseSensitivity(HMickeys,VMickeys,DSpeed)  Allows you to set the mickey
  170. '    to pixel ratio and the double speed at the same time.
  171. '-----------------------------------------------------------------------------
  172.  
  173.  
  174.  
  175. '-----------------------------------------------------------------------------
  176. 'declare sub SetMousePage(integer)
  177. '-----------------------------------------------------------------------------
  178. '  SetMousePage(pagenumber)  Informs the mouse which page is to be used to
  179. '    display it's cursor.  Note that you should also call ShowMouse if you
  180. '    change screen pages.
  181. '-----------------------------------------------------------------------------
  182.  
  183.  
  184.  
  185. '-----------------------------------------------------------------------------
  186. 'declare function GetMousePage%()
  187. '-----------------------------------------------------------------------------
  188. '  GetMousePage%  Returns the page currently displaying the mouse cursor.
  189. '-----------------------------------------------------------------------------
  190.  
  191.  
  192.  
  193. '-----------------------------------------------------------------------------
  194. 'declare sub ResetMouse()
  195. '-----------------------------------------------------------------------------
  196. '  ResetMouse  Acts exactly as IsMouse, except it does not return the number
  197. '    of buttons available on the mouse.  All mouse info is reset to it's
  198. '    default state.  (Note:  This is not Function 21H, Int 33H - I am using
  199. '    Function 00 so the hardware is also initialized).
  200. '-----------------------------------------------------------------------------
  201.  
  202.  
  203.  
  204. '-----------------------------------------------------------------------------
  205. 'declare function MouseInfo&()
  206. '-----------------------------------------------------------------------------
  207. '  MouseInfo&  Returns information on the mouse.  Example:
  208. '
  209. '    a& = Mouseinfo&
  210. '    major& = (a& / 65536) / 256    ' Major version #
  211. '    minor& = (a& / 65536) mod 256   ' Minor version #
  212. '    type& = (a& mod 65536) / 256    ' Type of mouse:
  213. '                                           1 = bus mouse
  214. '                        2 = serial mouse
  215. '                        3 = InPort mouse
  216. '                        4 = PS/2 mouse
  217. '                        5 = HP mouse
  218. '    irq&  = (a& mod 65536) mod 256  ' IRQ Number
  219. '    vers = major& + (minor& / 10)
  220. '    print using "Version ####.##  Type ####  IRQ ####";vers,type&,irq&
  221. '-----------------------------------------------------------------------------
  222.  
  223.  
  224. '-----------------------------------------------------------------------------
  225. 'declare sub MousePenOn()
  226. '-----------------------------------------------------------------------------
  227. '  MousePenOn  Allows the mouse to perform as a light pen in certain programs.
  228. '    By Pressing the left and right buttons at the same time, the mouse will
  229. '    emulate a light pen being triggered.  Please note that a ResetMouse or
  230. '    an IsMouse% will also turn light pen emulation on.
  231. '-----------------------------------------------------------------------------
  232.  
  233.  
  234.  
  235. '-----------------------------------------------------------------------------
  236. 'declare sub MousePenOff()
  237. '-----------------------------------------------------------------------------
  238. '  MousePenOff  Disables the ability to use the mouse as a light pen.
  239. '    Light pen emulation will be turned on by calling MousePenOn, ResetMouse,
  240. '    or IsMouse%
  241. '-----------------------------------------------------------------------------
  242.  
  243.  
  244. '-----------------------------------------------------------------------------
  245. 'declare function MouseType%()
  246. '-----------------------------------------------------------------------------
  247. '  MouseType% returns the type of mouse installed, where:
  248. '          1 = bus mouse
  249. '    2 = serial mouse
  250. '    3 = InPort mouse
  251. '    4 = PS/2 mouse
  252. '    5 = HP mouse
  253. '-----------------------------------------------------------------------------
  254.