mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 23:09:16 +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;
|
FDecimals := 0;
|
||||||
end;
|
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
|
// included by spin.pp
|
||||||
|
@ -147,6 +147,7 @@ type
|
|||||||
procedure SetValue(const AValue: integer); overload; virtual;
|
procedure SetValue(const AValue: integer); overload; virtual;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
|
function GetLimitedValue(const AValue: Double): Double; override;
|
||||||
public
|
public
|
||||||
property Value: integer read GetValue write SetValue default 0;
|
property Value: integer read GetValue write SetValue default 0;
|
||||||
property MinValue: integer read GetMinValue write SetMinValue default 0;
|
property MinValue: integer read GetMinValue write SetMinValue default 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user