Accessing Controls Within a Cluster Using a Property Node

Updated Dec 1, 2023

Environment

Software

  • LabVIEW

I have a set of controls embedded within a cluster and I want to access a property of one of the controls. Can I access any specific properties (e.g., background color for a string control) for one of these controls?

There are three ways to access the properties of a control within a cluster. 

A) Using an Implicit Property Node

  1. Right-click the embedded/nested control on the front panel—not the cluster itself—and select Create»Property Node and place the property node on the block diagram. Configure the property node as read or write to access or modify properties.
    1. It is also possible to create a control with an associated property node outside of a cluster and move the control into a cluster. The control will still be associated with the property node after the control is moved into the cluster.
 

B) Using an Explicit Property Node:

  1. Right-click the control on the front panel and select Create»Reference. This will create a reference on the block diagram.
  2. On the block diagram, right-click the output terminal of the reference and select the desired property from Create»Property menu option.
    1. The following image demonstrates how to edit a property of a Ring Control using this method.

 

C) Using the Cluster Reference and Explicit Property Nodes:

  1. Right-click the cluster control on the front panel and select Create»Reference. This will create a reference to the cluster on the block diagram.
  2. On the block diagram, use a Property Node and wire the Cluster reference to it. Select the Controls[] property to get the reference to all its contained controls.
  3. Use an Index Array function to select the item inside the cluster that you wish to modify.
  4. Use a To More Specific Class VI to be able to use the properties and methods of the specific control type you wish to modify. Wire the control's reference from the Index Array function to the input of the To More Specific Class VI. Create a constant for the input located in the top called Target Class. Click on the constant and select Generic»GObject»Control»<Your control type> to force the reference to be this class and give access to its specific properties.
  5. Place another Property Node in the block diagram and wire the reference coming out from the To More Specific Class VI. You will notice you can now chose the properties for that specific control type you selected with the constant in the previous step.
  6. Right-click the property node and select Change All to Write. Select the property you desire to modify and wire the desired data.

Additional Information

These methods use the LabVIEW VI Server. The VI Server has an object-oriented architecture that is platform-independent.  Each object that is a part of the VI Server is a part of a class. The class that the object is a part of determines what properties and methods are available. For instance, any boolean control is a member of the Boolean class, which is a member of the Control class. The Control class is a member of the GObject class, which is a member of the Generic class. Lower level classes, such as the Boolean class, have their own properties and methods, and inherit properties and methods from higher level classes, such as the Generic class. Read more here: What Is the VI Server?