Left button, right button...

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Left button, right button...

Post by bjb007 » Fri Feb 29, 2008 6:52 am

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.
Life is just a bowl of cherries.

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Fri Feb 29, 2008 9:37 am

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

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Left button, right button...

Post by bjb007 » Fri Feb 29, 2008 2:51 pm

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.
Life is just a bowl of cherries.

Post Reply