LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically know which index the user has selected of an array of clusters

Solved!
Go to solution

I agree with altenbach in that the index property only shows which elements is the topmost and not which element was clicked in if more than one element is visiable.

 I did something  where I displayed an array of cluster and if the operator clicked in one of the clusters I could tell which one they click in. 

Note this quick mock up has the index and label of the array turned off because they will miss up the math

If you need them visiable you can figure out how to do the math.

 

Omar
0 Kudos
Message 11 of 22
(1,809 Views)

Anna - thanks for the screenshot!

However that property is always zero in LabVIEW 7.  Is there a way to tell which element is selected in LabVIEW 7?

ArrayElement.Value shows the value of the selected element, but I need to know the index - i.e., which element of the array.

I can send the value back through a one-dimension array search, but that seems really tacky if I already have a handle on which element I need.

Many thanks!!

0 Kudos
Message 12 of 22
(1,786 Views)

We already told you several times that the "index vals" property corresponds to the array element in the upper left corner of the (possibly scrolled) array display. It will show zero unless you scroll the array elsewhere, so this is not what you want.

 

You still haven't told you what you mean by "selected", because that's not a well defined operation.

 

Once you tell us what you mean by "selected", we can possibly help you. What is the user operation that that make an element selected?

 

  • Do you mean the element that just got modified?
  • The element that got a mouse down?

 

And since you don't have an answer yet, please remove the "accepted solution" tag further up, else people think this thread is solved and skip it.

Message Edited by altenbach on 01-13-2010 09:55 PM
0 Kudos
Message 13 of 22
(1,773 Views)

Here's one possible interpretation of a solution to the problem at hand: Add a checkbox to the cluster, indicating selection.

 

I no longer have access to LabVIEW 7.0, so 8.0 is the lowest I can do. Maybe somebody can downconvert it further.

 

 

0 Kudos
Message 14 of 22
(1,765 Views)

Sorry - I don't know how to turn off the "solved" flag.

 

Attempting to express the issue more clearly - when the user selects an element of an array by clicking it - i.e., triggers a MouseDown event, the ArrayElement.Value property receives the contents of that element.  What is the best way to get the index of the element that has been selected?

 

Passing ArrayElement.Value into Search1DArray works but is just not elegant because LabVIEW has already determined the index in order to load the ArrayElement.Value property.

 

Playing games with locations of things on the screen also works but is painfully inelegant.

 

Guess I'm a little old school in wanting to write good code, not just something that works.  Thanks for your indulgence!

0 Kudos
Message 15 of 22
(1,759 Views)

Hello, I took a look at the solution posted by Gator, by your description it does what you are trying to do. I also don't have LabVIEW 7.1 but here is a screen shot of the code:

 

2010-01-14_144641.png

National Instruments
0 Kudos
Message 16 of 22
(1,725 Views)

Hi this is my i am selecting the index manaually but i need to change the index automatically so that i can read the every row one by one

 

 

 

Thanks in advance

 

 

 

0 Kudos
Message 17 of 22
(1,275 Views)

Do not Hijack a thread that is way old. Also your question is not clear, 'Change the Index automatically' what does it mean? Do you want to read the rows one by one in certain interval and display them else you have any other condition?. Please explain.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 18 of 22
(1,273 Views)

The "Array Element" property of an array will return a reference to the most recently selected array element.  Getting the value from that is quite easy, but getting the array index is a bit tricky,

You'll have to calculate it from the position of the array, the position of the array element, the size of the element, and the current array index value.

0 Kudos
Message 19 of 22
(1,265 Views)

yeah anand..

 

exactly the same! i want to read the rows one by one with certain interval

 

thanks in advance

 

 

 

0 Kudos
Message 20 of 22
(1,262 Views)