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 can I get a reference to all controls on a front panel of one type )for example of the type Text Ring?

I'd like to set the strings[] property of all the Text Ring controls on a front panel at once without creating a property node for every text ring. How can i do that?
0 Kudos
Message 1 of 3
(2,581 Views)
You could get the reference to the front panel then get the array of references of controls from that. Search the array for references whose class id match that of a Text Ring and make modification to those references. You'll need to typecast the reference to a more specific class to change something like the strings[] property. I made a quick vi to demonstrate this. See if it helps you out...

Brian
Message 2 of 3
(2,581 Views)
> How can I get a reference to all controls on a front panel of one type
> )for example of the type Text Ring?
>
> I'd like to set the strings[] property of all the Text Ring controls
> on a front panel at once without creating a property node for every
> text ring. How can i do that?

This is likely more complicated than making property nodes for each
ring, but you can do it. Make a subVI that takes in a panel reference,
reads the array of control references, loops through them looking for
rings, and modifying the Strings[] property on each ring.

The part of this that will probably be the least obvious, when you
have an array of control references there are two ways to find out
if an element is a ring. You can read the classID and compare it
to the cla
ssID of a true ring control. An alternative is to cast
the control reference to a ring control using a Cast to more specific
node and wire the error out to a case structure. The error case is
where the objects that aren't rings will go. The success case case
where you will have a valid ring refnum that you can use to modify
the strings.

Greg McKaskle
Message 3 of 3
(2,581 Views)