From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Coordinates of array elements

Solved!
Go to solution

Hi,
I'm playing around with mouse click coordinates, mostly because its Friday afternoon Smiley Happy but also because it might be useful

In the attached code I wish to click on one of the strings of my array control and find out which element in the array it corresponds to. (This will later be used to fire up other bits of code depending on the array content)

I can use the position of the array and the coordinates of the mouse and it all works fine.
BUT... only if I select the zeroth element before I run the code. If I select any other element then run the code I get erroneous results.

So - is there a way to acquire the coordinates of the zeroth element of my array regardless of what the user has just done?

I can think of workarounds using the coordinates of the array control (instead of the string coordinates) but this is affected by the control label size/visibility so feels less reliable.

Using version 8.5.

Thanks,
Ian

0 Kudos
Message 1 of 5
(3,892 Views)
Solution
Accepted by topic author _Ian_

There is a utility VI from the LAVA repository located here.

 

That deals with this problem:

MouseDown.png

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 5
(3,888 Views)

Thanks - that does the trick.

I guess its a well thought out version of the "workaround" I'd decided I didn't like...

 

Cheers

Ian

0 Kudos
Message 3 of 5
(3,882 Views)

That vi is the bomb !!

 

The one thing that could make it better would be if you could make the cursor change to a pointer instead of the text bracket.   Have not investigated this yet but if I discover how to fix this, I will post it.

 

 

 

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 4 of 5
(3,617 Views)

great VI, thanks for this!

 

also, I could use it with multicolumn lists (with some little mofifications)

Pierre FCentum TNS, Grenoble
Certified LabVIEW Associated Developer
0 Kudos
Message 5 of 5
(3,381 Views)