LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I determine what element in an array was right clicked on?

Solved!
Go to solution

 

I have an array set up on my front panel. When the user right clicks on an element in that array, I would like them to be able select from 3 different options. I have the shortcut menu working, but I need to know which element in the array the user right clicked on to determine what values to change. How can I get the index of the element?

 

Thanks for any help!

 

 

0 Kudos
Message 1 of 7
(4,768 Views)
Solution
Accepted by redsnapper
0 Kudos
Message 2 of 7
(4,757 Views)

Solved it! Thanks

0 Kudos
Message 3 of 7
(4,739 Views)

I was curious and thought the proposed solution was heavy depending on what you need to do exacly...

 

So here's some alternate solution, hope it may be helpful. You can also write some value to the clicked element.

 

2015-06-11 14_04_44-getArray_clicked_value.vi Block Diagram.png

0 Kudos
Message 4 of 7
(4,721 Views)

Deleted dup.

0 Kudos
Message 5 of 7
(4,721 Views)

Here is my solution, from my toolbox:

WhichArrayElementClickedOn.PNG

 

It accounts for the possibility of the array being scrolled away from 0,0.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 6 of 7
(4,706 Views)

Couldn't you get index values from the array property node?

 

Also this doesn't account for if scrollbars are seen or not.  And I usually like to know if my range is valid, because again I could be clicking on a scrollbar, or label and still get the Mouse Down event.

 

Here is one I posted a while ago.

 

http://forums.ni.com/t5/LabVIEW/Interesting-way-to-detect-array-index-from-mouse-position/m-p/286841...

0 Kudos
Message 7 of 7
(4,660 Views)