LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a property for all of one type of control in a cluster programatically?

Solved!
Go to solution

Good Afternoon all,

 

I have a couple of clusters on my front panel, each made up with 7 rings, 7 LEDs, 7 numeric, and 7 strings....all controls.

 

There is a right and left cluster of these...but just concentrating on the left one to star with....specifically left LED 1 (named programmed 1).

 

In the course of my code, I've allowed the user to select it, LED turns on...and I disable it so it cannot simply be de-selected.

 

I have a button on the screen in which I will reset all LEDs that have been set and some  other controls too eventually.

 

I know that in this event, I can create 14 property nodes for each individual LED, and set it to Enable.

 

I'm just guessing there is some sort of more elegant way of doing this...similar to setting mass values for clusters, using the bundle by name, setting values, and writing out to the closter again.

 

I just can't seem to find a way to do this with the properties on the controls in the cluster as easily as you can do with the values....

 

Any suggestions?

 

Thank you,

 

cayenne

0 Kudos
Message 1 of 11
(3,894 Views)

not everbody has LV 2011

 

0 Kudos
Message 2 of 11
(3,885 Views)

Restructure your data.  Make a cluster containing the Tube ring (which, as I mentioned in a previous reply, should be an enum), the Prog boolean, and the Order numeric.  Then put several of those into the Selector cluster.  That will make it much easier to iterate through the cluster, enabling or disabling only the Prog boolean.

See image below (Clust Refnum and the property node to which it is attached should be replaced with an implicit property node referring to Left Selector) and attached VI:

disable boolean in cluster of clusters.png 

By the way, are you sure that you chose the right boolean action for the Enable Disable button?

Message 3 of 11
(3,881 Views)

You can use VI Scripting to do it. Traverse For GObjects to be more specific:

scripting.png

If you are not familiar with scripting - google it 😉

Message 4 of 11
(3,863 Views)

There's no scripting there, just standard VI properties.  It could equivalently be done like this:

disable booleans.png

Message 5 of 11
(3,853 Views)

@nathand wrote:

Restructure your data.  Make a cluster containing the Tube ring (which, as I mentioned in a previous reply, should be an enum), the Prog boolean, and the Order numeric.  Then put several of those into the Selector cluster.  That will make it much easier to iterate through the cluster, enabling or disabling only the Prog boolean.

See image below (Clust Refnum and the property node to which it is attached should be replaced with an implicit property node referring to Left Selector) and attached VI:

disable boolean in cluster of clusters.png 

By the way, are you sure that you chose the right boolean action for the Enable Disable button?


Thank you for the help. I"m trying to work with this...and I've noticed when I drop the refnum and the Property Node...that my objects on the block diagram don't say "Strict" like the ones in your example.

I'm not sure what the strict means....nor how to get mine to that state....

 

Would this be something causing the error I am getting while trying to put this together?

 

 

 

Thank you in advance,

 

cayenne

0 Kudos
Message 6 of 11
(3,852 Views)

@cayenne wrote:

Thank you for the help. I"m trying to work with this...and I've noticed when I drop the refnum and the Property Node...that my objects on the block diagram don't say "Strict" like the ones in your example.

I'm not sure what the strict means....nor how to get mine to that state....

 

Would this be something causing the error I am getting while trying to put this together?


Yes, that's probably causing the error.  I used a couple of tricks in putting that VI together.  One of them is that I dropped the inner cluster on the front panel, created a reference to it, created a constant from the reference, then deleted the front panel object.  What's left is a constant reference to a cluster type that is "strict" because it refers to a cluster with that specific set of elements.

 

Another trick is that the inner cluster is a "classic" cluster (instead of a "modern" one).  The classic cluster can be made fully transparent with the painting tool, so that it does not appear as a separate cluster on the front panel.  That inner cluster really should be a type definition - probably a strict type definition, although in that case you need to rework the so the "Tube" numbers line up the way you'd like - but I figured I was putting this together quickly and didn't bother with the typedef.

Message 7 of 11
(3,846 Views)

Don't forget to close all your references when you are finished using them...

Message 8 of 11
(3,828 Views)

@DFGray wrote:

Don't forget to close all your references when you are finished using them...


Shouldn't be necessary (although it would be a good habit) since it's all references to front-panel objects.

Message 9 of 11
(3,809 Views)

@nathand wrote:

@cayenne wrote:

Thank you for the help. I"m trying to work with this...and I've noticed when I drop the refnum and the Property Node...that my objects on the block diagram don't say "Strict" like the ones in your example.

I'm not sure what the strict means....nor how to get mine to that state....

 

Would this be something causing the error I am getting while trying to put this together?


Yes, that's probably causing the error.  I used a couple of tricks in putting that VI together.  One of them is that I dropped the inner cluster on the front panel, created a reference to it, created a constant from the reference, then deleted the front panel object.  What's left is a constant reference to a cluster type that is "strict" because it refers to a cluster with that specific set of elements.

 

Another trick is that the inner cluster is a "classic" cluster (instead of a "modern" one).  The classic cluster can be made fully transparent with the painting tool, so that it does not appear as a separate cluster on the front panel.  That inner cluster really should be a type definition - probably a strict type definition, although in that case you need to rework the so the "Tube" numbers line up the way you'd like - but I figured I was putting this together quickly and didn't bother with the typedef.


Whew.....this is starting to get beyond my noob knowledge...just know what I know so far, from the book Labview for Everyone.

 

Inner cluster...?  Are you talking about me taking apart what I have so far, code and all...do redo the big cluster, as a cluster of the 3 type of elements each as a separate cluster.

I'm just hoping to be able not to have to tear apart all the code I have so far....the example I'm giving is a simplfied version of my real one...that has a lot of code and events put in already.

 

Hmm....I was hoping to do what you suggested with the cluster of clusters for my version 2 of the thing, once past my deadline.

 

Is there a way to do the strict reference..without having to create extra things on the front panel, making references and then dropping them first?  Pretty much everything I've done so far, is using the 'modern' pallette....thinking newer was better.....

 

I'm trying to play with this some more. For time considerations, I may have to just create a node property for each separate item, and set the disabled on those this time around, but I do see your point on the cluster of clusters.....

 

I saw someone post about having to close my reference....is there a good way to do that, or a link for instructions on that?

 

I'm a bit lost on the error too...the class error and trying to cast to another type...not sure what it is telling me. 

 

I guess the basic thing I'm seeing here, is I need to understand more about the property node for Controls[] more...and what is different about it, from the more specific property nodes that you can set up.  I'm guessing this is going through a bout of abstraction and back...although, I'm not sure why it would be necessary.

 

Again..thank you for all the help, I guess I'm just a major noob, hitting some higher level topics.....

 

The help is VERY much appreciated as is the advice!!!

 

Cayenne

0 Kudos
Message 10 of 11
(3,802 Views)