04-14-2010 04:15 AM
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
04-14-2010 06:23 AM
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
04-14-2010 07:54 AM
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.
04-14-2010 08:10 AM
04-19-2010 05:35 AM
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
04-19-2010 06:31 AM
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,