01-07-2016 02:02 PM
I'm trying to configure a numeric control to display at least one decimal (1.0) but able to auto-adjust if user enters more (1.11).
%#g is great because it allows to show whatever decimals user enter, at the exception that it will show (1) instead of (1.0).
Is there a simple way to do this?
Cheers,
Jimmy
01-08-2016 09:45 AM
Simple way? It depends on your definition of "simple".
The way I know is that when a numeric control experiences a value-change event then a reference from it is passed to a subVI which analyzes the contained value and fiddles with the formatting of the control through the reference as needed. A "simple" demo of this is attached.
01-08-2016 09:55 AM
Yes, I couldn't find a way from Right Click >> Properties either.
01-08-2016 10:17 AM
@1abvi3w wrote:
I'm trying to configure a numeric control to display at least one decimal (1.0) but able to auto-adjust if user enters more (1.11).
%#g is great because it allows to show whatever decimals user enter, at the exception that it will show (1) instead of (1.0).
Is there a simple way to do this?
Cheers,
Jimmy
Unfortunatly there is no format specifier that do what you want. You would need a specifier that mean 1 or more decimal digits. # will always remove trailing zeros so you can't use it to get 1.0. Maybe you could develop an Xcontrol that does it (multiply the input by 10, apply %_#g formatting and divide by 10 after).
Ben64