Middle mouse button

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Middle mouse button

Post by paulclaude » Tue Nov 24, 2015 7:35 pm

There's a way to trap the middle mouse button (2) on OSX?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Middle mouse button

Post by FourthWorld » Tue Nov 24, 2015 8:21 pm

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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Re: Middle mouse button

Post by paulclaude » Wed Nov 25, 2015 2:29 pm

Thank you Richard, but on OSX the middle button (case 2) is not trapped by the mouseDown handler.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Middle mouse button

Post by FourthWorld » Wed Nov 25, 2015 3:02 pm

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?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Re: Middle mouse button

Post by paulclaude » Wed Nov 25, 2015 3:46 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Middle mouse button

Post by dunbarx » Wed Nov 25, 2015 4:05 pm

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

paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Re: Middle mouse button

Post by paulclaude » Wed Nov 25, 2015 4:12 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Middle mouse button

Post by FourthWorld » Wed Nov 25, 2015 5:40 pm

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/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

paulclaude
Posts: 121
Joined: Thu Mar 27, 2008 10:19 am

Re: Middle mouse button

Post by paulclaude » Thu Nov 26, 2015 1:54 pm

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

Post Reply