home *** CD-ROM | disk | FTP | other *** search
/ Megazine / Megazine-1.iso / PROGRAMA / CLIPPER / CALC223 / DCLMOUSE.PRG < prev    next >
Encoding:
Text File  |  1993-12-16  |  14.7 KB  |  222 lines

  1. * ┌─ Program ────────────────────────────────────────────────────────────────┐
  2. * │  Application: Calculator 2.0                                             │
  3. * │    File Name: dCLmouse.prg    dClip Mouse Interface for Calculator 2.0   │
  4. * │       Author: Jim Gale                                                   │
  5. * │ Date created: 10-03-93                                                   │
  6. * │ Time created: 11:06:04pm                                                 │
  7. * │    Make File:                                                            │
  8. * │    Exec File:                                                            │
  9. * │    Copyright: 1993 by Touchstone Business Creations                      │
  10. * └──────────────────────────────────────────────────────────────────────────┘
  11.  
  12. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  13. * │  Description: Determime if a mouse if present in the system.             │
  14. * │       Author: Jim Gale                                                   │
  15. * │ Date created: 10-30-93                                                   │
  16. * │ Time created: 09:35:00am                                                 │
  17. * │    Copyright: Touchstone Business Creations                              │
  18. * ├──────────────────────────────────────────────────────────────────────────┤
  19. * │     Function: CM_IsMouse()                                               │
  20. * │                                                                          │
  21. * │    Arguments: none                                                       │
  22. * │                                                                          │
  23. * │ Return Value: lMouseExists - logical value representing if a mouse is    │
  24. * │                              present.                                    │
  25. * │     See Also:                                                            │
  26. * │                                                                          │
  27. * └──────────────────────────────────────────────────────────────────────────┘
  28. Function CM_IsMouse()
  29. Return dc_moupresent()
  30.  
  31. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  32. * │  Description: Report which mouse button is being pressed.                │
  33. * │       Author: Jim Gale                                                   │
  34. * │ Date created: 10-30-93                                                   │
  35. * │ Time created: 09:35:52am                                                 │
  36. * │    Copyright: Touchstone Business Creations                              │
  37. * ├──────────────────────────────────────────────────────────────────────────┤
  38. * │     Function: CM_Button()                                                │
  39. * │                                                                          │
  40. * │    Arguments: none                                                       │
  41. * │                                                                          │
  42. * │ Return Value: nButtonPressed - numeric representing which mouse button   │
  43. * │                                was pressed:                              │
  44. * │                                                                          │
  45. * │               Valid Values are:                                          │
  46. * │                                                                          │
  47. * │                  0 = no button pressed (or mouse not present)            │
  48. * │                  1 = left button pressed                                 │
  49. * │                  2 = right button pressed                                │
  50. * │                                                                          │
  51. * │     See Also:                                                            │
  52. * │                                                                          │
  53. * └──────────────────────────────────────────────────────────────────────────┘
  54. Function CM_Button()
  55. Return dc_moubutton()
  56.  
  57. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  58. * │  Description: Report the mouse cursor row.                               │
  59. * │       Author: Jim Gale                                                   │
  60. * │ Date created: 10-30-93                                                   │
  61. * │ Time created: 09:39:26am                                                 │
  62. * │    Copyright: Touchstone Business Creations                              │
  63. * ├──────────────────────────────────────────────────────────────────────────┤
  64. * │     Function: CM_Row()                                                   │
  65. * │                                                                          │
  66. * │    Arguments: none                                                       │
  67. * │                                                                          │
  68. * │ Return Value: nMouseRow - numeric representing text row of mouse.        │
  69. * │     See Also:                                                            │
  70. * │                                                                          │
  71. * └──────────────────────────────────────────────────────────────────────────┘
  72. Function CM_Row()
  73. Return dc_mourow()
  74.  
  75. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  76. * │  Description: Report the mouse cursor column.                            │
  77. * │       Author: Jim Gale                                                   │
  78. * │ Date created: 10-30-93                                                   │
  79. * │ Time created: 09:39:58am                                                 │
  80. * │    Copyright: Touchstone Business Creations                              │
  81. * ├──────────────────────────────────────────────────────────────────────────┤
  82. * │     Function: CM_Col()                                                   │
  83. * │                                                                          │
  84. * │    Arguments: none                                                       │
  85. * │                                                                          │
  86. * │ Return Value: nMouseCol - numeric representing text column of mouse.     │
  87. * │     See Also:                                                            │
  88. * │                                                                          │
  89. * └──────────────────────────────────────────────────────────────────────────┘
  90. Function CM_Col()
  91. Return dc_moucol()
  92.  
  93. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  94. * │  Description: Turn the mouse cursor on.                                  │
  95. * │       Author: Jim Gale                                                   │
  96. * │ Date created: 10-30-93                                                   │
  97. * │ Time created: 09:40:26am                                                 │
  98. * │    Copyright: Touchstone Business Creations                              │
  99. * ├──────────────────────────────────────────────────────────────────────────┤
  100. * │     Function: CM_On()                                                    │
  101. * │                                                                          │
  102. * │    Arguments: none                                                       │
  103. * │                                                                          │
  104. * │ Return Value: n/a                                                        │
  105. * │     See Also:                                                            │
  106. * │                                                                          │
  107. * └──────────────────────────────────────────────────────────────────────────┘
  108. Function CM_On()
  109. Return dc_moushow()
  110.  
  111. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  112. * │  Description: Turn the mouse cursor off.                                 │
  113. * │       Author: Jim Gale                                                   │
  114. * │ Date created: 10-30-93                                                   │
  115. * │ Time created: 09:42:50am                                                 │
  116. * │    Copyright: Touchstone Business Creations                              │
  117. * ├──────────────────────────────────────────────────────────────────────────┤
  118. * │     Function: CM_Off()                                                   │
  119. * │                                                                          │
  120. * │    Arguments: none                                                       │
  121. * │                                                                          │
  122. * │ Return Value: n/a                                                        │
  123. * │     See Also:                                                            │
  124. * │                                                                          │
  125. * └──────────────────────────────────────────────────────────────────────────┘
  126. Function CM_Off()
  127. Return dc_mouhide()
  128.  
  129. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  130. * │  Description: Report the state of the cursor and optionally set it.      │
  131. * │       Author: Jim Gale                                                   │
  132. * │ Date created: 10-30-93                                                   │
  133. * │ Time created: 09:44:29am                                                 │
  134. * │    Copyright: Touchstone Business Creations                              │
  135. * ├──────────────────────────────────────────────────────────────────────────┤
  136. * │     Function: CM_Cursor([<lState>])                                      │
  137. * │                                                                          │
  138. * │    Arguments: [<lState>] - new state of cursor (on/off) - optional       │
  139. * │                                                                          │
  140. * │ Return Value: lOldState - old state of cursor (on/off)                   │
  141. * │     See Also:                                                            │
  142. * │                                                                          │
  143. * └──────────────────────────────────────────────────────────────────────────┘
  144. Function CM_Cursor(lNew)
  145. Local lRet:=dc_mouvisible()
  146.    If ValType(lNew)="L"
  147.       If(lNew,dc_moushow(),dc_mouhide())
  148.    Endif
  149. Return lRet
  150.  
  151. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  152. * │  Description: Initialize/Reset mouse system for calculator               │
  153. * │       Author: Jim Gale                                                   │
  154. * │ Date created: 10-30-93                                                   │
  155. * │ Time created: 09:44:42am                                                 │
  156. * │    Copyright: Touchstone Business Creations                              │
  157. * ├──────────────────────────────────────────────────────────────────────────┤
  158. * │     Function: CM_Init()                                                  │
  159. * │                                                                          │
  160. * │    Arguments: none                                                       │
  161. * │                                                                          │
  162. * │ Return Value: NIL                                                        │
  163. * │     See Also:                                                            │
  164. * └──────────────────────────────────────────────────────────────────────────┘
  165. Function CM_Init()
  166.    dc_mouinitialize()
  167. Return NIL
  168.  
  169. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  170. * │  Description: Provide any needed exit support for the mouse.             │
  171. * │       Author: Jim Gale                                                   │
  172. * │ Date created: 10-30-93                                                   │
  173. * │ Time created: 10:23:22am                                                 │
  174. * │    Copyright: Touchstone Business Creations                              │
  175. * ├──────────────────────────────────────────────────────────────────────────┤
  176. * │     Function: CM_Exit()                                                  │
  177. * │                                                                          │
  178. * │    Arguments: none                                                       │
  179. * │                                                                          │
  180. * │ Return Value: NIL                                                        │
  181. * │     See Also:                                                            │
  182. * │                                                                          │
  183. * └──────────────────────────────────────────────────────────────────────────┘
  184. Function CM_Exit()
  185. Return NIL
  186.  
  187. * ┌─ Function ───────────────────────────────────────────────────────────────┐
  188. * │  Description: Wait .2 seconds for a key or until a button is released.   │
  189. * │       Author: Jim Gale                                                   │
  190. * │ Date created: 10-30-93                                                   │
  191. * │ Time created: 09:47:46am                                                 │
  192. * │    Copyright: Touchstone Business Creations                              │
  193. * ├──────────────────────────────────────────────────────────────────────────┤
  194. * │     Function: CM_Wait(<nButton>,<lMousekey>)                             │
  195. * │                                                                          │
  196. * │    Arguments: <nButton>   - button state to wait for.                    │
  197. * │               <lMousekey> - whether to wait until a button is released.  │
  198. * │                                                                          │
  199. * │ Return Value: <nKey>      - numeric representing the key pressed.        │
  200. * │                                                                          │
  201. * │        Notes: This function is called by the calculator after            │
  202. * │               highlighting the button on-screen that was pressed/clicked.│
  203. * │                                                                          │
  204. * │               When a mouse is present, the purpose is to wait until it   │
  205. * │               is released so that drifting of the mouse does not cause   │
  206. * │               unwanted keystrokes.                                       │
  207. * │                                                                          │
  208. * │               Without a mouse present, the purpose is to wait .2 seconds │
  209. * │               for the highlighting effect (unless a key was pressed).    │
  210. * │                                                                          │
  211. * │     See Also:                                                            │
  212. * └──────────────────────────────────────────────────────────────────────────┘
  213. Function CM_Wait(n,lMousekey)
  214. Local nKey:=0
  215.    If lMousekey
  216.       While dc_moubutton()#n .and. (nKey:=Inkey())=0
  217.       Enddo
  218.    Else
  219.       nKey:=Inkey(.2)
  220.    Endif
  221. Return nKey
  222.