01-11-2010 01:58 PM
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
01-13-2010 07:43 PM
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!!
01-13-2010 11:54 PM - edited 01-13-2010 11:55 PM
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?
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.
01-14-2010 12:39 AM
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.
01-14-2010 01:10 AM
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!
01-14-2010 02:50 PM
12-24-2012 07:13 AM
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
12-24-2012 07:30 AM
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.
12-24-2012 08:55 AM
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.
12-24-2012 09:07 AM
yeah anand..
exactly the same! i want to read the rows one by one with certain interval
thanks in advance