LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read a mouse to determine whether the left or right button was clicked in LabVIEW 2010 Mac OS X?

Solved!
Go to solution

Hello

 

I recently upgraded from LabVIEW 7 to the 2010 version and I also migrated from using a PC to a Mac (OS X). I am having some difficulty finding how I can read a mouse to determine whether the left/right button was clicked - this was something that was done easily on the PC/earlier version but I can't seem to find the appropriate functions.

 

Any help/suggestions would be much appreciated.

 

Thanks,

0 Kudos
Message 1 of 5
(2,398 Views)

Hi Michmar,

 

You should be able to acomplish this by using an event structure with the source configured as Panes>Pane>MouseDown. I have put together an example vi in 2010 (attached) that should hopefully help you with this.

 

Let me know how you get on.

 

All the best!

0 Kudos
Message 2 of 5
(2,386 Views)
Solution
Accepted by topic author Michmar

Michmar,

 

As far as I know the Mac OS only recognizes one mouse button.  When you use another mouse/trackball with multiple buttons, you must use a driver provided by the device manufacturer to distinguish various buttons.  The code Paul H provided will count clicks but does not appear to distinguish between buttons.  I have a Kensington trackball with 4 buttons. One is set to click, another to double click.  The double click button records two counts in Paul H.'s VI. When I set one button to right click the VI records one count. One buttonis set to drag. The VI records one count for every other click.

 

In the Platform Folder of vi.lib is a Mac Mouse Buttons Down.vi. This produces an array of booleans. It does distinguish the right click! Boolean 0 is true for any of the click, double click, and drag functions, but Boolean 1 goes true for right click.

 

So, it looks like NI provided what you need. There is no help file for that VI, so no explanation of what buttons produce what outputs.  Experiment!

 

Lynn

Message 3 of 5
(2,382 Views)

Thanks johnsold, that's interesting to know as I have not specifically worked with the Mac OS myself.

 

Let us know how you get on Michmar.

0 Kudos
Message 4 of 5
(2,346 Views)

Hi Lynn

 

Thanks very much for that - that was exactly what I needed! I am now able to distinguish button presses. Hooray!

 

Cheers,

Michelle

 

 

0 Kudos
Message 5 of 5
(2,326 Views)