Page 1 of 1
Left button, right button...
Posted: Fri Feb 29, 2008 6:52 am
by bjb007
My buttons all work with left and right clicks.
I expected I could restrict the button script
to a left click with "on mouseDown 1" but
seems not. The docs mention theButton which
I expect is a variable holding the button number
but beyond that .....zero.
All suggestions considered.
Posted: Fri Feb 29, 2008 9:37 am
by Klaus
All this is in fact in the docs!
From the entry for "mouseup":
##############
Parameters:
The mouseButtonNumber specifies which mouse button was pressed:
* 1 is the mouse button on Mac OS systems and the left button on Windows and Unix systems.
* 2 is the middle button on Unix systems.
* 3 is the right button on Windows and Unix systems and Control-click on Mac OS systems.
###############
Here an example for your convenience:
Code: Select all
on mouseup num_o_button
switch num_o_button
case 1
## handle left (normal) mouse click
break
case 2
## handle middle mouse click
break
case 3
## handle right mouse click
break
end switch
end mouseup
Same applies for "mousedown" etc., of course.
Regards
Klaus
Left button, right button...
Posted: Fri Feb 29, 2008 2:51 pm
by bjb007
Klaus
Read all I could find in the docs but didn't
find an example and never would have
figured it out.
Seems that "on mouseUp 1" or
"on mouseUp(1) or "on mouseUp,1"
would be a logical system which would
obviate the need for "case" statements etc.
Anyway, thanks for the example.