Change the Property of an Object within a LabVIEW Cluster

Updated May 3, 2018

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Other

Windows 7

Issue Details

I want to change the property of an object within my cluster. How can I access it?

Solution

Generally, properties can be changed with just a property node. Since the object is within a cluster however, we will need to perform additional steps to access that property.

The following example describes how to overwrite the color property of an numeric indicator within a cluster. These steps can be applied to other objects or properties as well:

1. Create a reference for the cluster (Right-Click -> Create -> Reference)
2. Place a property node onto the block diagram
3. Wire the cluster reference into the property node
4. Left-Click on the property and select 'Controls []'
5. Please an Index Array function onto the block diagram
6. Wire the 'Controls []' property into the Index Array function
7. Place and wire a numeric constant into the Index Array to select which indicator you would like to alter. A 0 would reference the top-most item in the cluster.
8. Place a 'To More Specific Class' node onto the block diagram
9. Wire in the output of the Index Array to the 'To More Specific Class' node
10. Create a reference to the numeric indicator (Right-Click on the indicator -> Create -> Reference)
11. Wire the reference into the top of the 'To More Specific Class' node
12. Place another property node onto the block diagram
13. Wire in the output of the 'To More Specific Class' node into the property node
14. Left-Click on the property and select the 'BG Color' property (Numeric Text -> Text Colors -> BG Color)
15. Right-Click on the 'BG Color' property and select 'Change To Write'
16. Wire in a 'Color Box' control or constant to the 'BG Color' property 
 

A finished example that demonstrates access to objects within clusters can also be found in the online example library

Additional Information

The 'To More Specific Class' node is used to cast the type of reference to a 'Numeric'. This is necessary because the reference output of the 'Index Array' is a control refnum, and in order to select the 'BG Color' property we need to change the reference type to one that has that property.

WAS THIS ARTICLE HELPFUL?

Not Helpful