mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-07 08:26:57 +02:00
IDEIntf: use decimal point always in property editor for floating point values.
git-svn-id: trunk@51253 -
This commit is contained in:
parent
d1790be9f0
commit
2adb9b25c1
@ -3578,15 +3578,27 @@ end;
|
|||||||
function TFloatPropertyEditor.GetValue: ansistring;
|
function TFloatPropertyEditor.GetValue: ansistring;
|
||||||
const
|
const
|
||||||
Precisions: array[TFloatType] of Integer = (7, 15, 19, 19, 19);
|
Precisions: array[TFloatType] of Integer = (7, 15, 19, 19, 19);
|
||||||
|
var
|
||||||
|
FS: TFormatSettings;
|
||||||
begin
|
begin
|
||||||
|
FS := DefaultFormatSettings;
|
||||||
|
FS.DecimalSeparator := '.'; //It's Pascal sourcecode representation of a float, not a textual (i18n) one
|
||||||
Result := FloatToStrF(GetFloatValue, ffGeneral,
|
Result := FloatToStrF(GetFloatValue, ffGeneral,
|
||||||
Precisions[GetTypeData(GetPropType)^.FloatType], 0);
|
Precisions[GetTypeData(GetPropType)^.FloatType], 0, FS);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFloatPropertyEditor.SetValue(const NewValue: ansistring);
|
procedure TFloatPropertyEditor.SetValue(const NewValue: ansistring);
|
||||||
|
var
|
||||||
|
FS: TFormatSettings;
|
||||||
|
NewFloat: Extended;
|
||||||
begin
|
begin
|
||||||
//writeln('TFloatPropertyEditor.SetValue A ',NewValue,' ',StrToFloat(NewValue));
|
//writeln('TFloatPropertyEditor.SetValue A ',NewValue,' ',StrToFloat(NewValue));
|
||||||
SetFloatValue(StrToFloat(NewValue));
|
FS := DefaultFormatSettings;
|
||||||
|
FS.DecimalSeparator := '.'; //after all, this is Pascal, so we expect a period
|
||||||
|
if not TryStrToFloat(NewValue, NewFloat, FS) then
|
||||||
|
//if this failed, assume the user entered DS from his current locale
|
||||||
|
NewFloat := StrToFloat(NewValue, DefaultFormatSettings);
|
||||||
|
SetFloatValue(NewFloat);
|
||||||
//writeln('TFloatPropertyEditor.SetValue B ',GetValue);
|
//writeln('TFloatPropertyEditor.SetValue B ',GetValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user