12-31-2012 02:37 PM
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.
Solved! Go to Solution.
12-31-2012 03:03 PM
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.
01-01-2013 12:07 PM
@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.
01-01-2013 03:25 PM
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