12-22-2011 08:56 AM
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?
Solved! Go to Solution.
12-22-2011 09:08 AM
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.
12-22-2011 11:40 AM
Thanks,
That worked.
09-11-2015 09:26 AM
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
09-11-2015 09:43 AM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
09-11-2015 09:45 AM - edited 09-11-2015 09:50 AM
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.
09-11-2015 09:51 AM
Thanks for all your rapid answers. It works.