LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing control in a cluster with loops

Solved!
Go to solution

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)

0 Kudos
Message 1 of 13
(2,743 Views)

If all the clusters are the same type,  then just put them in an array.

 

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 13
(2,725 Views)

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.

0 Kudos
Message 3 of 13
(2,703 Views)

I would definitely go with references and value property nodes.

 

altenbach_1-1587002609245.png

 

Message 4 of 13
(2,683 Views)

@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. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 13
(2,658 Views)

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?

0 Kudos
Message 6 of 13
(2,645 Views)

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). 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 13
(2,642 Views)

Thanks! I worry about this being slow already, so I'll stick with local variables where I need to.

0 Kudos
Message 8 of 13
(2,635 Views)

@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)

0 Kudos
Message 9 of 13
(2,632 Views)
Solution
Accepted by topic author plasmageek

@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:

 

altenbach_1-1587052155577.png

 

 

Message 10 of 13
(2,627 Views)