09-18-2017 02:05 AM
Hi Guys,
I created a program which gets value from array via reference.
My problem is this method starts to get value the last element because that is on focus.
If I click another element (for example second) and run the program it starts to get value the second element.
I would like to set programmatically the focus on the zero element.
Is there any property to set the focus or other method to get the values?
Thanks a lot!
Best regard,
Roland
Solved! Go to Solution.
09-18-2017 02:14 AM - edited 09-18-2017 02:16 AM
Hi Roland,
what's the whole point of your VI?
Why don't you read the array value?
Why don't you parse the serialized string completely/correctly (as you already try to read the number of elements in the array)?
(Don't get upset by these questions as sometimes it will be easier to answer the general question instead of focusing on another workaround for obscure algorithms.)
I think in the OpenG library (found using VIPM) you will find functions to parse "generic" data as you seem to try here…
09-18-2017 02:33 AM
I can't open your VI as i'm on Lv2011 today, but from your description i tried this:
Hmm, the snippet lost the event type, i used Mouse Up in this case.
/Y
09-18-2017 03:15 AM
This doesn't work properly unless there is only a single element of the Array visible at the time of the event being raised.
So the workaround is clear, limit the view to the element you want and then and only then are you guaranteed that the "ArrayElem" is actually pointing to the element you want.
Horrible stuff but hey, it's been that way so long we can call it tradition now.
Shane
09-18-2017 07:42 AM
Hi all,
I saved the VI a previous 8.0 version and a made a picture which show my problem.
If I click into the zero element and after I run the VI the program will start to read with zero element (Good result.jpg)
But I click into the second element and after I run the VI the program will start to read with second element (Bad result.jpg)
I'd like to set the focus on the zero element programmatically. In the original program this array is generated by program so the focus is on the last element.
In the original program I've got one reference input that's why I used this way to solve the problem.
This VI just shows my problem.
I'm sorry for my bad English. I hope I can describe well my problem.
Thanks a lot.
Best regard,
Roland
09-18-2017 07:49 AM
Yes, this is exactly the problem. What you want to do will only work (and I'm repeating myself here) if you have a SINGLE visible element of your FP array control (or indicator).
The property "ArrayElem" returns a reference to the last active FP cell (UI-wise) which is not the same thing as the last Array element (data-wise). You can only do what you want if you programmatically reduce the size of your array so that one cell is visible. Then LV has no choice but to point to whichever cell is addressed by your array control indices. Otherwise you can hope and pray it works, but more often than not it won't.
09-18-2017 07:56 AM
09-18-2017 08:28 AM