From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change combo box inside a cluster

Solved!
Go to solution

I have a cluster with several controls in it. One of them is a combo box on which I need to occasionally change the items within. If the combo box was outside the cluster, I could easily access the combo box's "Strings[]" property. However, when inside the cluster, I don't seem to be able to get that property. In the snippet below, the combo box is the control at index 1. I pull out the reference for that control, connect it to a "property node" and the "Strings[]" property is nowhere to be found.

 

Does anyone know how to solve this?

accesscontrolincluster.png

Message 1 of 7
(3,823 Views)
Solution
Accepted by topic author kgolden

Hi,

 

take this simple way, create a prperty node for the cluster you have, right click on the prperty node and select link to, move through the sub lists till reaching combo box. see the attached.

Message 2 of 7
(3,818 Views)

Thanks,

 

That worked.

0 Kudos
Message 3 of 7
(3,800 Views)

Sorry I know that the post is from 2011 but the answer doesn't solve my problem.

I have exactly the same problem as describe in first post but my cluster is on the top vi of my project.

In the vi where I want to access to the combo box I have only access to the cluster reference and there is no link option towards on other object which is not on the front panel.

How to solve this problem?

Thanks

 

0 Kudos
Message 4 of 7
(3,425 Views)

The problem comes about because LabVIEW knows the reference to your cluster contains other controls, and the property node returns an array of controls one for each element in your cluster.  But what LabVIEW doesn't know is the type of controls that each element is.  Well it may know but because it needs to return an array of references, those references need to be of the same type, and control is the class that contains all of them.

 

To fix this what you need to do is use the To More Specific Class and wire a constant to the Target Class which is the type of control in that cluster.  For this to work we need to know the type, and if the type ever changes we may generate an error.  Here is an example where I have a cluster with a combo box and a numeric.  After telling LabVIEW the more specific class, I can then use properties of that specific class.

 

Test Cluster References_BD.png

Message 5 of 7
(3,415 Views)

You have several options.

 

1: If you know the exact position in the cluster, just index the Controls[] array, then use "to more specific class"

2: If you know the exact label in the cluster, scan the Controls[] array for that label, then use "to more specific class"

3: Scan through the Controls[] array using the "Class" or "Class Name" property until you find your combo. Then use "to more specific class"

 

I'd use option 3 personally.

 

Edit: decided to be not lazy and include a snippet.

combobox.png

Message 6 of 7
(3,413 Views)

Thanks for all your rapid answers. It works.

 

0 Kudos
Message 7 of 7
(3,405 Views)