diff --git a/components/lazcontrols/spinex.inc b/components/lazcontrols/spinex.inc index 6dba77ca76..ffe4534591 100644 --- a/components/lazcontrols/spinex.inc +++ b/components/lazcontrols/spinex.inc @@ -202,7 +202,7 @@ end; function TSpinEditExBase.MaxValueStored: Boolean; begin - Result := CompareValue(FMaxValue, T(DefMaxValue)) <> 0; + Result := true; //not SameValue(FMaxValue, DefMaxValue); end; procedure TSpinEditExBase.EditMouseWheelUp(Shift: TShiftState; @@ -252,7 +252,7 @@ end; function TSpinEditExBase.IncrementStored: Boolean; begin - Result := CompareValue(FIncrement, T(DefIncrement)) <> 0; + Result := true; end; function TSpinEditExBase.IsLimited: Boolean; @@ -466,13 +466,22 @@ begin Result := FFS; end; - procedure TCustomFloatSpinEditEx.EditKeyPress(var Key: char); begin if (Key in ['.',',']) then Key := FFS.Decimalseparator; inherited EditKeyPress(Key); end; +function TCustomFloatSpinEditEx.IncrementStored: Boolean; +begin + Result := not SameValue(FIncrement, DefIncrement); +end; + +function TCustomFloatSpinEditEx.MaxValueStored: Boolean; +begin + Result := not SameValue(FMaxValue, DefMaxValue); +end; + function TCustomFloatSpinEditEx.TextIsNumber(const S: String; out ANumber: Double ): Boolean; begin @@ -614,6 +623,16 @@ begin Result := StringReplace(ValueS, AThousandSeparator, '', [rfReplaceAll]); end; +function TCustomSpinEditEx.IncrementStored: Boolean; +begin + Result := not SameValue(FIncrement, DefIncrement); +end; + +function TCustomSpinEditEx.MaxValueStored: Boolean; +begin + Result := not SameValue(FMaxValue, DefMaxValue); +end; + procedure TCustomSpinEditEx.SetThousandSeparator(AValue: String); begin if FThousandSeparator = AValue then Exit; diff --git a/components/lazcontrols/spinex.pp b/components/lazcontrols/spinex.pp index 4b6c52732b..e602a00aa1 100644 --- a/components/lazcontrols/spinex.pp +++ b/components/lazcontrols/spinex.pp @@ -125,8 +125,6 @@ type procedure UpDownChangingEx(Sender: TObject; var {%H-}AllowChange: Boolean; {%H-}NewValue: SmallInt; Direction: TUpDownDirection); procedure UpDownClick(Sender: TObject; {%H-}Button: TUDBtnType); - function IncrementStored: Boolean; - function MaxValueStored: Boolean; protected function GetBuddyClassType: TControlClass; override; procedure DoEnter; override; @@ -136,6 +134,8 @@ type procedure EditKeyDown(var Key: word; Shift: TShiftState); override; procedure EditMouseWheelUp(Shift: TShiftState; MousePos: TPoint; var Handled: Boolean); override; procedure EditMouseWheelDown(Shift: TShiftState; MousePos: TPoint; var Handled: Boolean); override; + function IncrementStored: Boolean; virtual; + function MaxValueStored: Boolean; virtual; function SafeInc(AValue: T): T; virtual; abstract; function SafeDec(AValue: T): T; virtual abstract; procedure SetValue(const AValue: T); virtual; @@ -202,6 +202,8 @@ type protected function GetFormatsettings: TFormatSettings; procedure EditKeyPress(var Key: char); override; + function IncrementStored: Boolean; override; + function MaxValuestored: Boolean; override; function TextIsNumber(const S: String; out ANumber: Double): Boolean; override; function SafeInc(AValue: Double): Double; override; function SafeDec(AValue: Double): Double; override; @@ -314,6 +316,8 @@ type FThousandSeparator: String; procedure SetThousandSeparator(AValue: String); protected + function IncrementStored: Boolean; override; + function MaxValuestored: Boolean; override; function SafeInc(AValue: Int64): Int64; override; function SafeDec(AValue: Int64): Int64; override; function TextIsNumber(const S: String; out ANumber: Int64): Boolean; override;