LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie: How To Set Numeric Control's Label Programmatically?

Solved!
Go to solution
I have a numeric control and I would like to set the Label (and the Unit Label) programatically. I created a property node for the Label Text and then changed it to a write node. For now I just wire a constant into this property. When running I get the error "Input unit is not compatible with the current unit." However, both the property and the constant are "pink" strings. Is what I am trying to do possible? Apologies in advance for a noob question.
0 Kudos
Message 1 of 5
(3,825 Views)

If you get the help for that property node "Label.text" you will find that property in not available when running (the VI must be idle for that property to work). We will generally use teh "Caption" instead since that can be written when the VI is running.

 

... and before you ask...

 

Make sure you show the caption before attempting to write its string since it does not exist until to you show it (at least once).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 5
(3,821 Views)
Solution
Accepted by topic author mvinca

You won't be able to change the value of the owned label programatically. Here is a knowledge base article which explains that and a way to get around it:

Programmatically Changing the Label for a Control or Indicator in LabVIEW

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 3 of 5
(3,820 Views)

Also, you should be able to set the unit label programmatically but they need to be compatible with the existing unit. If the units are not compatible, LabVIEW will throw an error which is what you are seeing. Have a look at the following:

Associating Numeric Units with Floating-Point Numbers

which can also be accessed if you click on the Detailed Help in the Context Help window for the Unit Label Text property.  

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 4 of 5
(3,816 Views)
Thank you for your prompt answers. The link to the knowledge base article was especially useful because now I understand why this particular property is read only. (It is nice when it makes sense, instead of being seemingly arbitrary).
0 Kudos
Message 5 of 5
(3,776 Views)