Einzelnen Beitrag anzeigen
Alt 12.10.2012, 12:12   #146
leecher
Moderator
MOUSE_ST

E r g e b n i s / R e s u l t

Give the mouse status (position, buttons pressed)

B e s c h r e i b u n g / D e s c r i p t i o n

The mouse status function returns details of the current mouse position
and the status of either button.

Because of the limitations of the C Hook interface, only one parameter
may be returned to the calling program. So the x,y co-ordinate and
the button status is rolled up into one return parameter.

S y n t a x

Code:
status = call ('MOUSE_ST')
P a r a m e t e r

There are no parameters for this procedure

R e t u r n s

An integer value is returned.

The button status is multiplied by 10,000. So, button 1 would be 10,000,
button 2, 20,000 and buttons 1 and 2 pressed together would be 30,000.

Added to this is the vertical co-ordinate, multiplied by 100. The
vertical co-ordinate runs from 0 to 24.

Lastly, the horizontal co-ordinate is added to the status. This
co-ordinate runs from 0 to 79.

So, the mouse in the top, left corner, with no buttons pressed would
return 0.

The mouse in the lower, right corner with the left button pressed would
return - 1 * 10,000 + 24 * 100 + 79 = 12,479

B e i s p i e l / E x a m p l e

Code:
attach 'MOUSE' 
b = call('MOUSE_SH')          ! display the mouse cursor 
a = 0
while a < 30000               ! end the loop when both buttons are pressed
   b = call ('MOUSE_ST')      ! get the current mouse status 
   if a <> b
      a = b
      put a , do newline      ! print the mouse status
   end if 
end while
b = call('MOUSE_HI')          ! turn off the mouse cursor 
detach 'MOUSE'
leecher ist offline   Mit Zitat antworten