11-29-2018 02:38 PM
@itronChiraldude wrote:
Criticizing is pointless.
I am criticizing, because You do heavy operations on front panel objects instead of data in wires/memory. Involving the UI tread is an abomination. All the UI thread should do is asynchronously update the front panel from the transfer buffer when the data is written to the terminal.
I assume that the attached quick modification is what you are trying to do. I think it would be trivial to Put the 2D array of clusters into a DVR and operate on that using the DVR reference as one of the subVI connectors. Have an independent loop in the toplevel that occasionally reads the DVR and sends it to the terminal. (not shown)
11-29-2018 02:57 PM
@Ben wrote:
@paul.r wrote:
Seems like you want to update individual elements of the array by reference - I could be wrong, but I dont think there is any easy way to do this. Instead of using VI server, why not just modify the data directly, then write to the indicator?
You are correct there is no easy way but it can be done.
Key to doing it is to realize the array element in the top left corner is the element that gets the update.
Ben
Not quite. The element that gets the update is the most recent one to have key focus.
11-29-2018 03:01 PM
@paul_cardinale wrote:
@Ben wrote:
@paul.r wrote:
Seems like you want to update individual elements of the array by reference - I could be wrong, but I dont think there is any easy way to do this. Instead of using VI server, why not just modify the data directly, then write to the indicator?
You are correct there is no easy way but it can be done.
Key to doing it is to realize the array element in the top left corner is the element that gets the update.
Ben
Not quite. The element that gets the update is the most recent one to have key focus.
That may be part of what was escaping back when I was working it out. I did resort to setting only one element visible and using the indexes to set which element I wanted to target but in that case, I may have been indirectly setting the key focus.
Thank you!
Ben
11-29-2018 03:05 PM
Maybe something like this will get you going.
11-29-2018 03:37 PM
Looks like key focus is the issue. Everything I read points to the element being accessed by ArrElem as the one in the upper left corner but I guess the fine print is that this only fully applies if the array is reduced to having only one element visible. The IndexVals property actually behaves as though the last key focus location is 0,0
11-29-2018 03:37 PM
Either way, I think the better solution is maintaining the data and updating the control directly - Altenbach's solution is exactly what I was getting at.
11-30-2018 07:40 AM - edited 11-30-2018 07:43 AM
@paul.r wrote:
Either way, I think the better solution is maintaining the data and updating the control directly - Altenbach's solution is exactly what I was getting at.
I agree that the approach used by the OP is sub-optimal. I also appreciate the insight that was gained by answering the original question.
The knowledge that the "element" property points at the active value may offer a cleaner approach when I am dealing with a GUI supported by an event registered against a 2D array for "Value Changed". Before that adventure yesterday, I would have most likely been doing a compare of the Old and New values to discover which element had changed. But knowing that the "element" property of the array points at the element that has the key focus, I may be able to implement the event more efficiently. This could be important if I am dealing with a large array.
So knowing more than one way to get home from work is not a bad thing.
Thanks for the adventure!
Ben
11-30-2018 09:04 AM - edited 11-30-2018 09:05 AM
@Ben wrote:The knowledge that the "element" property points at the active value may offer a cleaner approach when I am dealing with a GUI supported by an event registered against a 2D array for "Value Changed". Before that adventure yesterday, I would have most likely been doing a compare of the Old and New values to discover which element had changed. But knowing that the "element" property of the array points at the element that has the key focus, I may be able to implement the event more efficiently. This could be important if I am dealing with a large array.
So knowing more than one way to get home from work is not a bad thing.
Thanks for the adventure!
Ben
This is pretty much what I do.
11-30-2018 10:40 AM
My approach is not sub-optimal, it is completely unworkable. My goal is to allow the user to use the scroll bar to view all array elements but any interaction by the user may change the key focus.
If the documentation had been clear about this, I never would have gone down that path!
11-30-2018 11:02 AM
@itronChiraldude wrote:
My approach is not sub-optimal, it is completely unworkable. My goal is to allow the user to use the scroll bar to view all array elements but any interaction by the user may change the key focus.
If the documentation had been clear about this, I never would have gone down that path!
I do not think the documentation staff ever considered what you were trying as being possible let alone actually trying to do it.
Re: That path
Now to try and put a positive spin on it... At the least the team here may have demonstrated their talent and quality of their insight. Hang out here long enough and you will get a chance to see the accidents of other and learn how to avoid those missteps.
Ben