LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the index of the selected array element?

I have a 1D array, and I'd like to programmatically find out which element the user has clicked on, i.e. the element that's currently selected.  How would I find this out?
 
I can get the reference of the current element, then do things with it to find out its value etc, but I need to know the index value of the element.
 
I've tried the "Selection Start" property, but this just returns zero each time.
 
My actual application is an array of clusters, but I've made a VI with just a simple 1D array of numbers and I still can't get this value.
 
I'm hoping someone can tell me the really obvious answer I've missed so I can slap my head and say "Doh".
 
Thanks
-Sean.
0 Kudos
Message 1 of 5
(37,426 Views)
Hi Sean,
I think there is no generic LabView solution, you have to get the Front panel position of the selected array element. I made an example...



Greets, Dave

P.S. btw. there was the reverse question answered here: http://forums.ni.com/ni/board/message?board.id=170&message.id=70107&query.id=6162

Message Edited by daveTW on 02-07-2007 05:20 PM

Greets, Dave
Message 2 of 5
(37,409 Views)

Also, using the suggested method, my example here shows a more generic solution. Note that the subVI there is also just an example and needs to expanded (to handle captions, for example, which after 7.0 you can't make invisible if you didn't manually show them).

If you want, you can find a more comprehensive example over at the LAVA forums' code repository.


___________________
Try to take over the world!
Message 3 of 5
(37,393 Views)

Here is the LAVA link

http://forums.lavag.org/Array-Point-to-RowCol-file11.html

Dan Shangraw, P.E.


   

0 Kudos
Message 4 of 5
(37,184 Views)

Long ago, I used the following code to get the index of the clicked element of an array indicator as part of my Tic-Tac-Toe Analyzer.

 All you need is one "subtract" and two "quotient&remainder" nodes. 😉

Remember you can do math on numeric clusters, so you can do the x and y at the same time to get the (row, column).

It's probably easiy to adapt it to your situation.

 

Click the following image to find the original posting: 😄



Message Edited by altenbach on 04-15-2008 08:36 AM
Message 5 of 5
(37,178 Views)