gtk interface: improved rounding of floatspinedit value, fixes issue #12006

git-svn-id: trunk@19826 -
This commit is contained in:
vincents 2009-05-06 14:17:30 +00:00
parent fdb51eba4c
commit df85c2d5c1

View File

@ -107,7 +107,10 @@ end;
class function TGtkWSCustomFloatSpinEdit.GetValue(
const ACustomFloatSpinEdit: TCustomFloatSpinEdit): Double;
begin
Result:=gtk_spin_button_get_value_as_float(PGtkSpinButton(ACustomFloatSpinEdit.Handle));
Result := gtk_spin_button_get_value_as_float(PGtkSpinButton(ACustomFloatSpinEdit.Handle));
// explicitly round to number of digits,
// to prevent rounding errors from single to double
Result:= RoundTo(Result, - ACustomFloatSpinEdit.DecimalPlaces);
end;
class procedure TGtkWSCustomFloatSpinEdit.SetSelStart(const ACustomEdit: TCustomEdit;