LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change cluster's controls StringsAndValues[] from SubVI

Solved!
Go to solution

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.

 

 

 

approach.PNG

Actor Framework
0 Kudos
Message 1 of 6
(1,532 Views)

It seems you have taken a Cluster reference instead of a Ring reference:

 

raphschru_0-1665741911982.png

 

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:

 

Access Cluster Elements.png

 

Message 2 of 6
(1,514 Views)

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

Actor Framework
0 Kudos
Message 3 of 6
(1,478 Views)

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.

0 Kudos
Message 4 of 6
(1,467 Views)
Solution
Accepted by topic author Quiztus2

Since you are using IMAQdx, there is a smarter way of doing:

Read IMAQdx Settings.png

 

Here you can provide any cluster with elements having the labels and types corresponding to supported attributes of your camera.

Message 5 of 6
(1,431 Views)

I found this thread discussing my point.

Unbundle cluster reference - Page 2 - NI Community

 

Thanks for your input. I will follow your suggestions.

Actor Framework
0 Kudos
Message 6 of 6
(1,414 Views)