LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change properties of multiple controls

I have a Panel with dozens of identical indicators on it.  I would like to be able to select them and change their properties.  For instance, delete all of their Tip Strips or turn on/off the Caption.  Do I reallly have to do this for each individual control?
Boyd Thomson
Hydrogenics Test Systems,
Burnaby, BC,
Canada
0 Kudos
Message 1 of 12
(3,706 Views)

Hello,

There is currently no interactive way to change the properties of multiple controls at once.  You could write a VI that iterates on the given controls and sets their properties programmatically.  Other than this, you are right, you must edit each control's properties individually.

LabVIEW R&D is looking into adding this functionality in a future LabVIEW version.

-D

Message 2 of 12
(3,703 Views)
I'm looking at the Panel->Controls[] property that exposes an array of references to all the controls on a panel. You can then get the properties of each control in the array. However, unlike the usual technique of using a single control reference instead of one element of the array of control references, there are some properties you can't access. For instance using a regular reference to a control you can modify the Format and Precision properties. When you use the reference that comes from the  Panel->Controls[] array you can't. If it did you could write a VI that generates a spreadsheet to display and modify, edit and re-write every controls properties. You can do that now for the limited sub-set of properties that are exposed.
 
I wish NI would make the references in the array refer to the more specific control so that all the properties got exposed.
 
Chuck Lippmeier
0 Kudos
Message 3 of 12
(3,596 Views)

Hi Chuck,


I wish NI would make the references in the array refer to the more specific control so that all the properties got exposed.

You can use the To More Specific Class function located on the Application Control palette to make your control references refer to a more specific type. For the Target Class input, select Generic >> GObject >> Control >> Numeric >> Digital and you can progamatically access properties such as Format and Precision.

I hope this helps!

Casey Weltzin
Applications Engineer
National Instruments

0 Kudos
Message 4 of 12
(3,573 Views)
Yes Chuck, but then it couldn't be an array could it...

Mike... (a voice from your past)

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 12
(3,571 Views)
Mike,
Ya I know. I was just trying to get the idea accross.
 
Casey,
Your approach works great. I knew I had to be on the right track about "To more specific class". What I was having trouble with was how to determine which more specific class I wanted to be. The ClassID property gives me that; so all I did was use it to select a "Class specifier constant to be the "target class" input to the "To more specific class" function. Now I can read and spreadsheet the format & precision properties as well as any other I want. Following is stream of thought: Now when I want to write the properties back can I use the "To more generic class" and "target class" or will that make the more specific property (Format & Precision) disappear? I'll try it.
Chuck
0 Kudos
Message 6 of 12
(3,559 Views)
Dooh,
I just tried it but it wasn't that hard. All I had to do was write to the more specific property and it took. No reason to bother with the "More Generic Class" function.
Chuck Lippmeier
0 Kudos
Message 7 of 12
(3,547 Views)

 


@chucklippmeier wrote:
I'm looking at the Panel->Controls[] property that exposes an array of references to all the controls on a panel.

Is there a way to specify a certain subset of the array of controls?

 

For instance, I have 100+ controls in the VI I'm working on, but I'd only like to iterate over, say, 10 ring controls (to enable/disable them based on a certain condition).

 

I know it's been a while since this thread was active but I'm hoping someone will be able to help! Or even better, that labview has since added functionality to support this (I'm using 2011, by the way).

 

Thanks!

0 Kudos
Message 8 of 12
(3,071 Views)

For that few controls, I would just create an array of their references.

 

You could filter the list based on data type or what not, but that can quickly get involved.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 12
(3,067 Views)

That was very helpful, and simple to implement (don't know why I didn't think of that before!).

 

Now the problem I'm having is I have a 1D array of ring controls within a cluster, and I need to iterate over the array and get the refnum of each ring.

 

I know how to get the refnum of a ring when it's not in an array, and I know how to get the refnum of an array, I'm just having trouble iterating over the array and programmatically getting a reference for each ring.

 

Note: for the purpose of scalability (is that a word?) the rings need to be in an array.

 

ring_refnum.JPG

0 Kudos
Message 10 of 12
(3,054 Views)