SpinEdit: support setting Text property

git-svn-id: trunk@53159 -
This commit is contained in:
ondrej 2016-10-19 10:25:58 +00:00
parent 7adca22c01
commit e9bfcc0273
2 changed files with 11 additions and 0 deletions

View File

@ -41,6 +41,16 @@ begin
Result := ValueToStr(FValue); Result := ValueToStr(FValue);
end; end;
procedure TCustomFloatSpinEdit.RealSetText(const AValue: TCaption);
var
NewValue: Double;
begin
if TryStrToFloat(AValue, NewValue) then
Value := NewValue
else
inherited RealSetText(AValue);
end;
procedure TCustomFloatSpinEdit.TextChanged; procedure TCustomFloatSpinEdit.TextChanged;
var var
PrevValue: Double; PrevValue: Double;

View File

@ -44,6 +44,7 @@ type
protected protected
class procedure WSRegisterClass; override; class procedure WSRegisterClass; override;
function RealGetText: TCaption; override; function RealGetText: TCaption; override;
procedure RealSetText(const AValue: TCaption); override;
procedure TextChanged; override; procedure TextChanged; override;
procedure SetDecimals(ADecimals: Integer); virtual; procedure SetDecimals(ADecimals: Integer); virtual;
procedure SetValue(const AValue: Double); virtual; procedure SetValue(const AValue: Double); virtual;