LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Num Control defaults to 0. Can this be changed to a blank?

Solved!
Go to solution

Num Control defaults to 0 on the front panel. Can this be changed to a blank as the default? I know one way to do it is to convert the num to a string. But on my front panel I have an array of clusters and I would prefer to keep the type of certain controls as numeric showing a blank rather that a zero.

0 Kudos
Message 1 of 4
(3,009 Views)

It is possible to use properties such as the format string property or the font color to make it appear as if there's an empty string (although if memory serves, a blank or whitespace format string is either invalid or treated as default), but this won't help with an array, because the properties for all elements of an array are always the same.

 

Another possibility might be an XControl which has the type as a numeric, but which actually displays a string control, but I'm not sure if they play well with arrays.


___________________
Try to take over the world!
Message 2 of 4
(3,001 Views)
Solution
Accepted by topic author chuck72352

@chuck72352 - tst gave you some good options for displaying it as a blank space, but the short answer is that no, there is no way to have a control have no number in it by default.

 

The long answer (as to the why) has to do with LabVIEW memory allocation and data lifetime.  In LabVIEW, unlike many other programming languages, a value is created or initialized as soon as you place a control, indicator, or constant on your VI and exist until LabVIEW performs automatic garbage collection.  In your case, as soon as you place an numeric control, you have initialized a numeric object.  Since the numeric object is initialized, it must have some value.  If it did not, you could run you code and have no number on the wire.  What it seems you are trying to accomplish is a numeric object that does not yet have a value, which generally doesn't exist in LabVIEW.  While a double precision number has something similar to this (NaN value), most data types in LabVIEW are never explicity created in the code, rather they exist as soon as the code is written.

 

Anyways, sorry if that was a little too academic, but it's a fundamental difference to LabVIEW that many people migrating to the language fail to realize.  For a data type in LabVIEW that does have a defined lifetime check out Data Value References.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
Message 3 of 4
(2,958 Views)

Thanks for the explanation, it's very helpful. For my application I used tst's suggestion to change the font color to match the control background color and that works great.

 

Thanks again tst and packersfan

0 Kudos
Message 4 of 4
(2,938 Views)