10-14-2022 04:50 AM
In order not to clutter my main.vi I try to move initializing my ring controls from within a SubVI.
I planned to pass a refernce to the SubVI and update then the cluster's controls StringsAndValues[].
Unfortunately my approach doesn't work. My Ring Controls don' get updated.
I propably have to cast my reference to my specific control's type in advance, but I don't know how.
Solved! Go to Solution.
10-14-2022 05:05 AM - edited 10-14-2022 05:12 AM
It seems you have taken a Cluster reference instead of a Ring reference:
If you want to access a Ring contained inside the Cluster, you can get the cluster elements with the "Controls[]" property.
Here for example I know the 1st element is a Ring, so I'm casting it to the Ring class using the "To More Specific" function:
10-14-2022 06:46 AM - edited 10-14-2022 06:56 AM
Thanks for your suggestion. This seems to introduce even more clutter, since the Controls[] elements are of different base types.
What I'am actually looking for is how to do somekind of reinterprete cast of the Clust Refnum to my typedefed control(Settings). So that my SubVI knows the types of the single control elements inside my typedefd control
10-14-2022 07:15 AM - edited 10-14-2022 07:15 AM
Your reference is of type "Cluster (strict)", so it has already all the information about data types inside the cluster.
However this is only useful for the "Value" property, as it will give your the right type for reading or writing it instead of a plain Variant.
As for other VI Server manipulations such as modifying the child element's properties, you must use the Controls[] property, which gives you generic (non-strict) Control references.
10-14-2022 09:08 AM
10-14-2022 09:40 AM
I found this thread discussing my point.
Unbundle cluster reference - Page 2 - NI Community
Thanks for your input. I will follow your suggestions.