LCL: override TSpinEdit.GetLimitedValue so it cannot return values outside the integer range. Issue #0032793.

git-svn-id: trunk@61945 -
This commit is contained in:
bart 2019-09-29 10:21:16 +00:00
parent 315062347c
commit 96eee65d5d
2 changed files with 11 additions and 0 deletions

View File

@ -272,4 +272,14 @@ begin
FDecimals := 0;
end;
function TCustomSpinEdit.GetLimitedValue(const AValue: Double): Double;
begin
//The WS may call this function for both TSpinEdit and TFloatSPinEdit, so we cannot change signature to have integer parameters
Result := inherited GetLimitedValue(AValue);
if Result > MaxInt then
Result := MaxInt;
if Result < Low(Integer) then
Result := Low(Integer);
end;
// included by spin.pp

View File

@ -147,6 +147,7 @@ type
procedure SetValue(const AValue: integer); overload; virtual;
public
constructor Create(TheOwner: TComponent); override;
function GetLimitedValue(const AValue: Double): Double; override;
public
property Value: integer read GetValue write SetValue default 0;
property MinValue: integer read GetMinValue write SetMinValue default 0;