home *** CD-ROM | disk | FTP | other *** search
- ********************
- ********************
- **
- ** Source File ... OOPS.PRG
- **
- ** Application ... OOPs
- ** Copyright (c) 1990 Lamaura Development Limited
- ** All Rights Reserved
- **
- ** Author ........ Philip de Lisle
- ** Last Update ... 14 September 1990 at 10:25 PM
- ** Purpose ....... Mouse Demo Using UDOs
- **
- ********************
- ********************
-
-
- #include 'object.ch'
- #include 'mouse.ch'
-
- *|
- *| Compiled with /n - hence the need for an explicit function call
- *|
-
-
- function OOPS
- **
- ** Syntax ..... OOPS()
- **
- ** Purpose .... OOPs Mouse Demo
- **
- ** Argument ... None
- **
- ** Returns .... Nothing
- **
-
- local nM_Y, nM_X, nKey, cMsg, nButton
-
- public oMouse // VITAL - otherwise we can't call the mouse from any
- // point in our application
-
-
- cls
-
- @ 1,27 say 'User Defined Objects Demo'
- @ 2,27 say '~~~~~~~~~~~~~~~~~~~~~~~~~'
- @ 3,22 say 'Copyright (c) 1990 Phil de Lisle'
-
- @ 5,5 say 'To QUIT demo, Click Mouse on QUIT Radio Button (left mouse button)'
-
- @ 10,10 say '< QUIT >' // Quit Radio Button
-
- oMouse := MouseNew() // create a new instance of our mouse UDO
-
- SEND oMouse:Color := 'n/w'
- SEND oMouse:Install()
- SEND oMouse:Show() // so we can see it!
-
- do while .t.
- keyboard ''
- M_ClearButton(LEFT_BUTTON)
- M_ClearButton(RIGHT_BUTTON)
- M_ClearButton(BOTH_BUTTONS)
-
- SEND oMouse:Activate()
-
- SEND oMouse:Info() // Update the mouse UDO instance variables
- SEND oMouse:Button TO nButton
- SEND oMouse:YPos TO nM_Y
- SEND oMouse:XPos TO nM_X
- SEND oMouse:Ascii TO nKey // in case user pressed a key
-
- do case
- case RadioButtonPress(oMouse, 10, 11, 10+len('< QUIT >')-2)
- exit
- case nButton = LEFT_BUTTON
- cMsg := 'Left Button Pressed'
- case nButton = RIGHT_BUTTON
- cMsg := 'Right Button Pressed'
- case nButton = BOTH_BUTTONS
- cMsg := 'Both Buttons Pressed'
- case nKey # nil
- cMsg := 'You pressed the "' + chr(nKey) + '" key'
- endcase
-
- @ 23,0
- @ 23,0 say cMsg
- enddo
-
- @ 23,0
- @ 23,0 say 'Goodbye ...'
-
- SEND oMouse:Hide() // turn mouse cursor off
-
- return (nil)
- *| EOF OOPS
-
- *|----------------------------------------------------------------------------|*