LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I enable / disable & hide a cluster programmatically in the block diagram?

Solved!
Go to solution

Hello, I have a user interface where I have several clusters of controls.  I would like to programmatically enable and disable entire clusters at a time.  I have two questions related to this.

 

  1. How do I actually change the enabled / disabled state of a cluster programatically?
  2. If I right click on a cluster, and go to Advanced > Enabled State, I see an option to make clusters "Disabled & Grayed".  How do I gray out a cluster programmatically?

Thanks for all your help!  I did a previous Google search on this, but while people talked about overall strategies of how to organize it into sub-VIs, I couldn't quite parse exactly the mechanism for enabling / disabling on the block diagram.

0 Kudos
Message 1 of 6
(4,319 Views)

You would create a property node for the cluster and write the desired state to it.

0 Kudos
Message 2 of 6
(4,300 Views)
Solution
Accepted by topic author airoll

At first, I was confused by what you wanted to do.  I tend to think of Cluster as an association of various data elements, a grouping, so to speak, usually for purposes of logical simplicity in what I am trying to do.

 

What I think you are talking about is a Front Panel Control (or Indicator) where data elements are graphically associated with each other (and also, of course, programmatically associated), and you want to change the ability of the User to interact with these Controls or Indicators.

 

For that, there are Properties available.  As Altenbach mentions, one of these is the Disabled property, which can take on three Enum values:  Enabled, Disabled, and Disabled & grayed.  There is another useful property you can use, the Visible property -- if an Control is not Visible, you cannot interact with it or change it from the Front Panel.  

 

Here's an exercise -- open a Block Diagram and drop an Error Control, a Cluster.  Right-click it and choose Properties.  Notice the Label and Caption both have a Visible checkbox, and the Enabled State shows the three Enum values associated with this Cluster.  

 

Now go to the Block Diagram.  Right-click the Error control and Create Property Node, which shows you the long list of Properties for this Control.  Note that Label and Caption have a sub-property of Visible, and a separate Visible property is present for the Control, itself.  The "Enabled State" property that you saw earlier is here called the "Disabled" property (why be consistent?).  You can use Property Nodes to read the Control/Indicator's Properties or to write (and thus set) these Properties. 

 

Bob Schor 

0 Kudos
Message 3 of 6
(4,278 Views)

With clusters you can also create property node for individual controls contained within it, which can sometimes be useful. Also make sure to only update the property node when its new value differs from the current setting. It is inefficient to write the same property over and over with the same value.

 

I often have cluster controls where some of the elements are used as "controls", but others are used as "indicators" (their value is updated by code based on the values in some of the other cluster controls) so they are "disabled" (but not greyed), preventing user interaction. Mix&match. Here it is often sufficient to set the properties statically.

 

Please explain in more details what you are trying to do.

0 Kudos
Message 4 of 6
(4,266 Views)

Thanks so much for answering my questions everyone!  I was able to figure it out, thanks to your help.  Specifically, I needed to make the change "Change to Write" to make the PropertyNode writeable.

0 Kudos
Message 5 of 6
(4,244 Views)

Going back to the title of the thread (..."disable & hide ...") ...

If you hide a control, there is of course no need to disable it.

0 Kudos
Message 6 of 6
(4,168 Views)