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 Initialize Rings in an Array of Clusters?

Solved!
Go to solution

I have a control which has an array of a cluster consisting of a Ring, a string and a boolean control.     Each index of the array has an associated Ring, which I would like to initialize at startup.

 

For example, index 0 will list the options for variable #1, index 1 lists the associated options for the second variable...and so on.    Attached is a basic code which continues to crash for type mismatch at the second 'To More Specific Class'.    This basic structure was based on other solutions posted.   

 

Any ideas??

0 Kudos
Message 1 of 5
(2,664 Views)

Each element of the array must have the same properties, the only thing that can be different is the value.

 

So there is no way you can make the ring in the cluster that makes up each element of the array have different string values to choose among.

0 Kudos
Message 2 of 5
(2,657 Views)
Solution
Accepted by topic author Joshu

You have a loop that's trying to cast each control in the cluster to a ring. Trying to cast a string control to a ring will generate an error, which is what you are seeing. You should only be casting the first element of the array (assuming the first element is the ring).

 

That said, what you are trying to do won't work. You cannot set different strings for the ring for the different array elements. Array elements can only vary in value. They cannot vary in terms of properties, and the list of strings would be a property. Thus, all of the rings would have the same list of choices. You cannot set them to be different.

 

I don't know what your ultimate goal is in terms of user interface, but you will need to think of a different way to do it. Is this array of limited length? If so, then perhaps you can use a cluster of clusters. Or perhaps you can use a separate control to select which set to look at and you update a single front panel ring and string from your underlying data.

0 Kudos
Message 3 of 5
(2,656 Views)

I had to disconnect from the control typedef to run since you didn't include it, and it didn't crash in LV 2011; so the type mismatch crash is probably related to the use of a typedef; though regardless, this won't work the way you want it to.  Elements of an array always have identical appearance.  When you affect the appearance (in this case the strings of the ring control) of the Array Element, you are affectively changing the appearance of all array elements.  So the last thing you write will be what you see in the control.  That is why there is only one Array Element reference and no way to cycle through the array index. 

 

Also, you referenced the controls incorrectly.  If the Array Element is a cluster, then the Controls property gives the controls of the cluster.  Only the first element of that controls array is a ring.

0 Kudos
Message 4 of 5
(2,655 Views)

I disconnected the TypeDef and got it to work....kinda.     Thanks for the responses.   It appears that the Ring is not the correct control feature since the Strings[] parameter is common.   I saw another example which used a ComboBox which enables each index to have a different set of options.   I'll post when it finally works.

0 Kudos
Message 5 of 5
(2,640 Views)