home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / xbase / library / clipper / mouse / u_mouse / oops.prg < prev    next >
Encoding:
Text File  |  1990-09-14  |  2.3 KB  |  99 lines

  1. ********************
  2. ********************
  3. **
  4. **   Source File ... OOPS.PRG
  5. **
  6. **   Application ... OOPs
  7. **                   Copyright (c) 1990 Lamaura Development Limited
  8. **                   All Rights Reserved
  9. **
  10. **   Author ........ Philip de Lisle
  11. **   Last Update ... 14 September 1990 at 10:25 PM
  12. **   Purpose ....... Mouse Demo Using UDOs
  13. **
  14. ********************
  15. ********************
  16.  
  17.  
  18. #include 'object.ch'
  19. #include 'mouse.ch'
  20.  
  21. *|
  22. *|  Compiled with /n - hence the need for an explicit function call
  23. *|
  24.  
  25.  
  26. function OOPS
  27. **
  28. **  Syntax ..... OOPS()
  29. **
  30. **  Purpose .... OOPs Mouse Demo
  31. **
  32. **  Argument ... None
  33. **
  34. **  Returns .... Nothing
  35. **
  36.  
  37. local nM_Y, nM_X, nKey, cMsg, nButton
  38.  
  39. public oMouse          //  VITAL - otherwise we can't call the mouse from any
  40.                        //          point in our application
  41.  
  42.  
  43. cls
  44.  
  45. @ 1,27 say 'User Defined Objects Demo'
  46. @ 2,27 say '~~~~~~~~~~~~~~~~~~~~~~~~~'
  47. @ 3,22 say 'Copyright (c) 1990 Phil de Lisle'
  48.  
  49. @ 5,5 say 'To QUIT demo, Click Mouse on QUIT Radio Button (left mouse button)'
  50.  
  51. @ 10,10 say '<  QUIT  >'   //  Quit Radio Button
  52.  
  53. oMouse := MouseNew()     //  create a new instance of our mouse UDO
  54.  
  55. SEND oMouse:Color := 'n/w'
  56. SEND oMouse:Install()
  57. SEND oMouse:Show()             //  so we can see it!
  58.  
  59. do while .t.
  60.    keyboard ''
  61.    M_ClearButton(LEFT_BUTTON)
  62.    M_ClearButton(RIGHT_BUTTON)
  63.    M_ClearButton(BOTH_BUTTONS)
  64.  
  65.    SEND oMouse:Activate()
  66.  
  67.    SEND oMouse:Info()             //  Update the mouse UDO instance variables
  68.    SEND oMouse:Button TO nButton
  69.    SEND oMouse:YPos   TO nM_Y
  70.    SEND oMouse:XPos   TO nM_X
  71.    SEND oMouse:Ascii  TO nKey     //  in case user pressed a key
  72.  
  73.    do case
  74.       case RadioButtonPress(oMouse, 10, 11, 10+len('<  QUIT  >')-2)
  75.            exit
  76.       case nButton = LEFT_BUTTON
  77.            cMsg := 'Left Button Pressed'
  78.       case nButton = RIGHT_BUTTON
  79.            cMsg := 'Right Button Pressed'
  80.       case nButton = BOTH_BUTTONS
  81.            cMsg := 'Both Buttons Pressed'
  82.       case nKey # nil
  83.            cMsg := 'You pressed the "' + chr(nKey) + '" key'
  84.    endcase
  85.  
  86.    @ 23,0
  87.    @ 23,0 say cMsg
  88. enddo
  89.  
  90. @ 23,0
  91. @ 23,0 say 'Goodbye ...'
  92.  
  93. SEND oMouse:Hide()       //  turn mouse cursor off
  94.  
  95. return (nil)
  96. *| EOF OOPS
  97.  
  98. *|----------------------------------------------------------------------------|*
  99.