Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-01

DecimalSeparator automatic change ?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

LacaK

Hi,
I have strange problem, I have application on Windows 2012 Server, where is set locale to Slovak (DecimalSeparator is comma) In my application in DataModuleCreate I explicitly set FormatSettings.DecimalSeparator='.' (dot)
All works as expected (decimal numbers are formated with "dot"), but after some time (hours) when application runs, DecimalSeparator changes back to "comma" ?
Is it possible ?
AFAIK International settings are initialised once in sysutils initialization section, or are they reevaluated later ? Thanks
-Laco.

Michael Van Canneyt
to LacaK
LacaK wrote 11 lines
Hi, I have strange problem, I have application on Windows 2012 Server, where is set locale to Slovak (DecimalSeparator is comma) In my application in DataModuleCreate I explicitly set FormatSettings.DecimalSeparator='.' (dot) All works as expected (decimal numbers are formated with "dot"), but after some time (hours) when application runs, DecimalSeparator changes back to "comma" ? Is it possible ? AFAIK International settings are initialised once in sysutils initialization section, or are they reevaluated later ?

They are initialized once in FPC.

But there is a windows message that notifies applications when the settings change:

http://stackoverflow.com/questions/7385357/window-message-notification-language-and-locale

Maybe lazarus picks it up.

Michael.

LacaK
to Michael Van Canneyt

Michael Van Canneyt wrote / napísal(a):

Show quoted text 26 lines
On Fri, 17 Jan 2014, LacaK wrote: > Hi, > I have strange problem, I have application on Windows 2012 Server, > where is set locale to Slovak (DecimalSeparator is comma) > In my application in DataModuleCreate I explicitly set > FormatSettings.DecimalSeparator='.' (dot) > All works as expected (decimal numbers are formated with "dot"), but > after some time (hours) when application runs, DecimalSeparator > changes back to "comma" ? > Is it possible ? > AFAIK International settings are initialised once in sysutils > initialization section, or are they reevaluated later ? They are initialized once in FPC. But there is a windows message that notifies applications when the settings change: http://stackoverflow.com/questions/7385357/window-message-notification-language-and-locale Maybe lazarus picks it up.

Thank you Michael,
it is exactly so.

Lazarus catch WM_SETTINGCHANGE and calls Application.IntfSettingChange which calls GetFormatSettings in SysUtils
It can be switched off by setting Application.UpdateFormatSettings:=False;

Interesting ...
Thanks
-Laco.