View Issue Details

IDProjectCategoryView StatusLast Update
0018354FPCRTLpublic2011-01-02 00:22
Reporterdenver jen Assigned To 
Status newResolutionopen 
Product Version2.4.2 
Summary0018354: FormatFloat , TMaskEdit
DescriptionUsing FormatFloat() and MaskEdit undex OSX 10.6.5 ( Intel )
with fpc 2.4.2 and Lazarus build

FormatFloat( '#,###.00',1234.56 ) => output 1234.56
Under Win32 and Linux => output 1,234.56

MaskEdit1.Alignment := taRightJustify not work in OSX but
working fine in both Win32 and Linux
TagsNo tags attached.
Fixed in Revision
Attached Files


Marco van de Voort

2010-12-31 20:43

manager   ~0044771

Since these kinds of behaviours might be dependant on what the localisation of the OS is, could you please specify what the localisation variables are initialized to in the three testcases (linux,windows,osx)?

Specially the following variables (sysutils.):

1) decimalseparator
2) thousandseparator
3) currencyformat
4) currencydecimals
5) negcurrformat

thank you.

denver jen

2010-12-31 21:01

reporter   ~0044773

ShowMessage( FormatFloat( '#,###.00',1234.56 ) ) ;

win32 -> 1,234.56 <== fine and ok
linux -> gtk2 -> 1,234.56 <== fine and ok
osx -> carbon -> 1234.56 <== missing the thousandseparator

For OSX, I checked the Language and text. The currency spearator and number separator for thousands are both ','


Marco van de Voort

2010-12-31 21:15

manager   ~0044774

I meant print or showmessage them, to see if the settings in the OS propagate properly to the program. It will also help to create a testcase regardless of OS settings (by hardcoding them)

denver jen

2011-01-01 13:15

reporter   ~0044780

Last edited: 2011-01-01 13:21

It is very easy to to reproduce this feature missed in OSX :
A sample program is attached

unit main;

{$mode objfpc}{$H+}


  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, MaskEdit;


  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    MaskEdit1: TMaskEdit;
    MaskEdit2: TMaskEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    { private declarations }
    { public declarations }

  Form1: TForm1;


{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
  MaskEdit1.Text := FormatFloat( '#,###.00',1234.56 ) ;

procedure TForm1.Button2Click(Sender: TObject);
  MaskEdit2.Alignment := taRightJustify ;

  {$I main.lrs}


2011-01-01 13:20 (479,449 bytes)

Marco van de Voort

2011-01-01 18:39

manager   ~0044782

Try to add clocale to your .lpr uses clause.

denver jen

2011-01-01 22:08

reporter   ~0044787

just add clocale in the .lpr uses clause
and also the main.pas too.

It not works for OSX->carbon.

BTW, Is FormatFloat() should be locale free ? cause we already provide the format
like '#,###.00' for it. No matter the locale, it should format the number by the given format.

The MaskEdit2.Alignment := taRightJustify also not not work for OSX->carbon.

Marco van de Voort

2011-01-02 00:22

manager   ~0044788

I don't know what the exact specifications are for formatfloat, but usually interpunction in format masks are localizable. This because the format routine must be able to recognize the interpunction.

Issue History

Date Modified Username Field Change
2010-12-31 18:14 denver jen New Issue
2010-12-31 20:43 Marco van de Voort Note Added: 0044771
2010-12-31 21:01 denver jen Note Added: 0044773
2010-12-31 21:15 Marco van de Voort Note Added: 0044774
2011-01-01 13:15 denver jen Note Added: 0044780
2011-01-01 13:20 denver jen File Added:
2011-01-01 13:21 denver jen Note Edited: 0044780
2011-01-01 18:39 Marco van de Voort Note Added: 0044782
2011-01-01 22:08 denver jen Note Added: 0044787
2011-01-02 00:22 Marco van de Voort Note Added: 0044788