[Lazarus] TFloatSpinEdit and DecimalSeparator (GTK)

zeljko zeljko at holobit.net
Fri Mar 13 16:29:56 CET 2009


On Friday 13 March 2009 14:27, Bart wrote:
> > You included clocale unit in your .dpr (UNIX targets only) ?
> >  DecimalSeparator at programstart: '.' (period) = DEFAULT , that means
> > that clocale unit is missing.
>
> I was under the impression that the value of SysUtils.DecimalSeparator
> was determined/set at programstart using locale settings?
> (At least in Windows it seems to be)
> Are they hardcoded in Linux version of SysUtils?

Under windows SysUtils have correct locales, but under unix (linux & mac) it's 
a mess, so that's the reason of clocale unit usage.
With clocale included you'll get correct locales.

>
> I'll try inclusing clocale unit and see what it does.
> Do I have to call some proc/function to make it set the value of
> DecimalSeparator?

No, but you can always say DecimalSeparator := ',';

>
> >  DecimalSeparator visible in control: ',' (comma) = that means that gtk
> >  controls uses libc (right) locales, setted up by LANG variable.
>
> And GTK1 differs form GTK2 with same locale setting?
>
> What LANG variable should I look for?
> (I'm not sure but I think I only saw one: it's value being nl_NL or
> something the like)

if LANG=nl_NL then glibc (under linux) reads it's locale settings for nl_NL 
eg.
DecimalSeparator := ',';
ThousandSeparator := ' ';
DateSeparator := '.';
ShortDateFormat := 'something'
if LANG=en_US then DateSeparator := '/' .... etc ...etc ...

SysUtils are not "multiplatform" in that case, so you have to use clocale 
unit.

zeljko






More information about the Lazarus mailing list