Page 1 of 1

Middle mouse button

Posted: Tue Nov 24, 2015 7:35 pm
by paulclaude
There's a way to trap the middle mouse button (2) on OSX?

Re: Middle mouse button

Posted: Tue Nov 24, 2015 8:21 pm
by FourthWorld
In LiveCode mouseDown and mouseUp messages are accompanied by an argument which is the mouse button number, e.g.:

Code: Select all

on mouseDown pBtn
  switch pBtn
  case 1
    DoNormalClickStuff
    break
  case 2
    DoMiddleButtonStuff
    break
  case 3
    DoRightClickStuff
    break
  end switch
end mouseUp

Re: Middle mouse button

Posted: Wed Nov 25, 2015 2:29 pm
by paulclaude
Thank you Richard, but on OSX the middle button (case 2) is not trapped by the mouseDown handler.

Re: Middle mouse button

Posted: Wed Nov 25, 2015 3:02 pm
by FourthWorld
paulclaude wrote:Thank you Richard, but on OSX the middle button (case 2) is not trapped by the mouseDown handler.
What model of mouse is it?

Re: Middle mouse button

Posted: Wed Nov 25, 2015 3:46 pm
by paulclaude
A Logitech M185. But I've tried also another mouse, with the same effect. I run OSX 10.11 (El Capitan) with LC 7.1.1 (rc 2).

Re: Middle mouse button

Posted: Wed Nov 25, 2015 4:05 pm
by dunbarx
Hi.

Is it possible that the Logitech mouse has to be configured so that the middle button is properly designated? I have a multi-button Logitech, and a control panel is required to set all the gadgets on it.

Craig Newman

Re: Middle mouse button

Posted: Wed Nov 25, 2015 4:12 pm
by paulclaude
I've configured my Logitech mouse assigning Midle Click function to the middle button, and it works perfectly on every app, Finder included.

From the Livecode dictionary:
Parameters:
The buttonNumber specifies which mouse button to check:

* 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.

It talk about Unix systems only...

Re: Middle mouse button

Posted: Wed Nov 25, 2015 5:40 pm
by FourthWorld
I haven't used that model, but in the past I have successfully used a Logitech mouse with LC. The scroll wheel sends a rawyKey down message, equivalent to scrolling messages from the keyboard. But clicking the scroll wheel has produced a 2 argument to mouseup.

If you're not seeing that perhaps the Cocoa change introduced an issue that needs resolving. You may want to file a bug report for that:
http://quality.livecode.com/

Re: Middle mouse button

Posted: Thu Nov 26, 2015 1:54 pm
by paulclaude
I've found something strange. Disabling all mouse external extensions, the following code works as expected, giving the button number for all buttons:

Code: Select all

on mouseDown pBtn
   put pBtn
end mouseDown
but this, give the button "down" only for mouse button 1 and 3:

Code: Select all

on mouseMove
   put mouse(1)&&mouse(2)&&mouse(3)
end mouseMove
so I can't trap mouse button 2 in an unlocked field, 'cause "if the Browse tool is being used, and you click an unlocked field with mouse button 1 or 2, no mouseDown message is sent".