04-15-2020 03:54 PM
I made a very simplified version of what I want to do (attached). Essentially, I have multiple clusters and I need to change a value in a cluster within a loop and I would like it to update the control so I can easily call/use it in other parts.
This is the 'easiest' way I have found, but it seems...counter productive? The example only has two clusters, but my main code is a lot of clusters (16+ and counting). Making a local (or a reference for a property node) for every single one (plus checks to find out which one needs to be updated) seems like it adds a lot of waste. Is there an easier way to update my panels (i.e., 'variables' , even though that's not how labview tags them)
Solved! Go to Solution.
04-15-2020 04:24 PM
If all the clusters are the same type, then just put them in an array.
04-15-2020 05:22 PM
Thanks! That'd be a great solution. Unfortunately, while the example allows for that, the real code does not. It's more like this updated version. I'm thinking at this point a shift register and not worrying about updating the front panel. I can keep values auto-updated greyed out and disabled (which they are anyway, but it's not ideal and may be confusing for people) in a majority of the cases, and just have to suck up using locals for the few where I can't.
I was just hoping there was an easier way to talk to my controls. The current methods seem pretty inconvenient for very large programs where keeping the UI minimal is key for readable and memory.
04-15-2020 09:04 PM
04-16-2020 02:55 AM
@plasmageek wrote:
Is there an easier way to update my panels (i.e., 'variables' , even though that's not how labview tags them)
The Wire is the variable. The indicator is just a visual UI detail to give you information. 🙂
04-16-2020 08:52 AM
So I keep reading in older posts that property nodes are more memory intensive and people say not to use them if they can be avoided. Is that not the case anymore? What's the pro/con of property nodes versus local variables?
04-16-2020 09:06 AM - edited 04-16-2020 09:07 AM
Value nodes require a shift to the UI thread and is a lot slower, like 1000x, than a Wire or Local variable. If you're dealing with a slow process like a user clicking a button it's ok(-ish). 🙂
04-16-2020 09:28 AM
Thanks! I worry about this being slow already, so I'll stick with local variables where I need to.
04-16-2020 10:40 AM - edited 04-16-2020 10:42 AM
@plasmageek wrote:
So I keep reading in older posts that property nodes are more memory intensive and people say not to use them if they can be avoided. Is that not the case anymore? What's the pro/con of property nodes versus local variables?
This is UI code that executes very occasionally based on user interactions, so speed is not of any concern here. Worry about these things if they are in a tight loop, executing millions of times per second.
Also note that you could even create references to elements inside the cluster, no need to update everything in the cluster as you currently do.
If you have performance issues, this is definitely not it! You need to look elsewhere to tighten your code. We can help, of course.
(Of course you can stand on your toes while looking at the moon at night, and geometrically your eyes will be closer to it, but practically you won't really notice a difference. trust me! :D)
04-16-2020 10:49 AM
@altenbach wrote:
Also note that you could even create references to elements inside the cluster, no need to update everything in the cluster as you currently do.
Here's how that could look like: