mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-24 01:59:43 +02:00
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:
parent
315062347c
commit
96eee65d5d
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user