LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

numeric control: decimal separator

Hi all! 

 

It seems that one cannot change the decimal point in a numeric control to comma or anything else. Does anyone have a good workaround?

Of course internally the representation of a double must have a point, but the visualization and input should be changeable to local settings.

 

Thanks and regards

Steffen

0 Kudos
Message 1 of 6
(4,831 Views)

Hi Steffen,

 

You are right, the configuration options of numeric controls are limited and I am not aware of any possibility to adjust the separation character.

There is only the possibility to have another control sitting on top of it, and if you are lucky, this character will cover the dot but not be too wide to overlap the number... You would have to move this overlapping character programmatically if precision etc. is changed.

 

For the long term, I can only suggest to request this feature using http://digital.ni.com/applications/psc.nsf/default?openform 

I did so recently concerning the also missing possibility to have a plus sign in numeric controls. Let's see if / when these wishes will be fulfilled 🙂

 

Wolfgang

0 Kudos
Message 2 of 6
(4,825 Views)

You can use

    SetSystemAttribute (ATTR_USE_LOCALIZED_DECIMAL_SYMBOL, 1);
to use the decimal separator set in the control panel inside numeric indicator / controls in your UIR. This must be done programmatically (ideally at program start) and affects all and only UIR controls (numeric, graph axis labels and so on); that is, strings obtained with sprintf or Fmt will still use a period as the decimal separator.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 6
(4,818 Views)
Definitely the best thing to do is to wait for Roberto's answer...
0 Kudos
Message 4 of 6
(4,812 Views)

Roberto, thank you for your answer.

 

Maybe you also have a suggestion for the following problem: I now have changed the windows system settings via Win SDK programatically (SetLocaleInfo) to the decimal separator that I need. But unfortunately this change is not recognized by my CVI application until I restart the application.

Does anybody have an idea how to force the application to "reload" the windows system settings?

 

Or alternatively I could shutdown my app. and restart it automatically - is there any "restart" function in CVI?

 

Thanks

Steffen

0 Kudos
Message 5 of 6
(4,752 Views)

Hi Steffen,

 

For that purpose you can write a simple batch file or a second application that calls your program with different command line arguments.

Your main application can read the input parameters and you can code it to distinguish the program call reason (first time or second time).

 

Another solution that comes to my mind is the atexit function.

You can register your own application to start itself upon its exit. See the function help for details.

I cannot try that right now but I'll be glad if you can try it and inform us of results.

 

Hope this helps, 

 

S. Eren BALCI
IMESTEK
0 Kudos
Message 6 of 6
(4,749 Views)