LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Method of setting control given label and value

Solved!
Go to solution

Given a name/value pair, how do I set a front panel control with the label name to a value of value?

 

This seems like it should be simple but I can't see it.

0 Kudos
Message 1 of 16
(3,816 Views)
Solution
Accepted by topic author kc64

I am assuming you are referring to a control on another VI. In that case you need to open a reference to that VI and then just use the Set Control Value method:

 

 

Note that I am using the variant version of that method. There is also one that works with flattened data. Please check the documentation for further details.

Message 2 of 16
(3,806 Views)

You can not change the lable of a control when the program is running you need to change the caption text. You also need to ensure that you are displaying the caption on the control on the front panel.

 

22467i02BD728A8F42EB19

 

Can be done easy with a propert node.

Tim
GHSP
0 Kudos
Message 4 of 16
(3,799 Views)

What they said!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 16
(3,794 Views)

 


@aeastet wrote:

You can not change the lable of a control when the program is running you need to change the caption text. You also need to ensure that you are displaying the caption on the control on the front panel.

 


 

I don't believe the user is trying to change the label. I believe they're just trying to change the value.

 

 


  Can be done easy with a propert node.

Of course, only if we're referring to the control being on the same VI. Smiley Wink

 

0 Kudos
Message 6 of 16
(3,772 Views)

I take the original question as this.  Given a certain name/value pair, the OP wants to look for the control whose label matches name.  When found, he wants to change the value of that control to value.  For example, if there are two controls labeled CTRL1 and CTRL2, and his input is CTRL2/5.4, then he wants to change the value of CTRL2 to 5.4.  If I am correct, here is the solution.  Use methods and property nodes to get all controls, and look for the one whose label matches name.  When found, change its value.

 

22477iB9C343E872035323

- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 16
(3,752 Views)

The Ctrl Val.Set method is perfectly happy to use the implied 'This VI' reference when the VI reference is left unwired and change the specified control value on the same VI as well as the previous example of doing it on a different VI.

0 Kudos
Message 8 of 16
(3,744 Views)

Thank you all for your rapid-fire answers.  The method proposed first is the one I was seeking.  The link in the second post to Darren's nugget repeatedly referred to the property node for Control Value > Set, which doesn't exist.  It should have said "invoke node".

 

Had I to do over again, I would have asked "Given two strings, one for the name of a control, and one for the value of the control, how do you set the value of control name  to value value?"  I think this adds a level of difficulty not presented earlier.  I will sort out a way of making this work using the first example given.  Thanks to all and if you have any comments on the revised question, please don't hesitate to reply to that one also.

 

This is why I love the NI LV forums.  You all bust your bums to try to help each other.

 

Thanks.

0 Kudos
Message 9 of 16
(3,730 Views)

Do you mean this?

 

22483iAD04C25637FA62C8

Tim
GHSP
0 Kudos
Message 10 of 16
(3,722 Views)