Hi
AdvEdit.FloatValue:=2;
FormatSettings.DecimalSeparator:='.' // AdvEdit.FloatValue=0 !!
FormatSettings.DecimalSeparator:=',' // AdvEdit.FloatValue=2
If set the DecimalSeparator to '.', the FloatValue's value changed to 0 !
Thanks in advance.
WIN 7, Delphi XE, TMS CP 6.9.3.0
Was retested here with a default TAdvEdit on the form and all 3 sequences were tested:
Sorry, a piece of information is absent:
AdvEdit.EditType:=etFloat;
By this settings the AdvEdit.FloatValue give wrong value.
Retested with
advedit1.EditType := etFloat;
Possible it's depend on Windows regional and language settings.
My settings: Format= magyar(Magyarország) and Region= Magyarország,
This mean, the decimalseparator=',' = comma
This is the simple sample output:
AdvEdit1.Properties=default properties.
I can only suspect that you're not using the latest version.
We cannot reproduce this.
You can download our test app from:
The Test work perfect, but:
1, Set AdvEdit1.Precision from 0 to 2.
2, After the set the DecimalSeparator, get the AdvEdit1.FloatValue !
The AdvEdit1.FloatValue changed wrong to 0. The displayed value not changed.
In AdvEditTest i changed only the AdvEdit1.Precision to 2, and insert a memo lines.
procedure TForm6.Button1Click(Sender: TObject);
begin
advedit1.EditType := etFloat;
advedit1.FloatValue := 2;
Memo1.Lines.Add( (sender as TButton).Name );
Memo1.Lines.Add(floattostr(AdvEdit1.FloatValue));
FormatSettings.DecimalSeparator:=',';
Memo1.Lines.Add(floattostr(AdvEdit1.FloatValue));
end;
procedure TForm6.Button2Click(Sender: TObject);
begin
advedit1.EditType := etFloat;
advedit1.FloatValue := 2;
Memo1.Lines.Add( (sender as TButton).Name );
Memo1.Lines.Add(floattostr(AdvEdit1.FloatValue));
FormatSettings.DecimalSeparator:=',';
Memo1.Lines.Add(floattostr(AdvEdit1.FloatValue));
FormatSettings.DecimalSeparator:='.';
Memo1.Lines.Add(floattostr(AdvEdit1.FloatValue));
end;
procedure TForm6.Button3Click(Sender: TObject);
begin
advedit1.EditType := etFloat;
advedit1.FloatValue := 2;
Memo1.Lines.Add( (sender as TButton).Name );
Memo1.Lines.Add(floattostr(AdvEdit1.FloatValue));
FormatSettings.DecimalSeparator:='.';
Memo1.Lines.Add(floattostr(AdvEdit1.FloatValue));
end;
The problem exists in TMS CP 7.0.3.0 (AdvEdit 3.2.0.3).
If TAdvEdit contains the text 2,0 and behind its back you change the decimal separator to '.' it is normal that it won't be able to parse 2,0 to value 2. As the conversion fails it returns zero.
It's normal.
Ok.