LCL Spin: fix case of Integer/string types

This commit is contained in:
Ondrej Pokorny 2022-01-06 14:16:18 +01:00
parent 8f868ae0e9
commit 624ef51567
2 changed files with 24 additions and 24 deletions

View File

@ -232,12 +232,12 @@ begin
end;
end;
function TCustomFloatSpinEdit.ValueToStr(const AValue: Double): String;
function TCustomFloatSpinEdit.ValueToStr(const AValue: Double): string;
begin
Result := FloatToStrF(GetLimitedValue(AValue), ffFixed, 20, DecimalPlaces);
end;
function TCustomFloatSpinEdit.StrToValue(const S: String): Double;
function TCustomFloatSpinEdit.StrToValue(const S: string): Double;
begin
try
Result := GetLimitedValue(StrToFloatDef(S, FValue));
@ -254,45 +254,45 @@ end;
{ TCustomSpinEdit }
function TCustomSpinEdit.GetIncrement: integer;
function TCustomSpinEdit.GetIncrement: Integer;
begin
Result:=round(FIncrement);
end;
function TCustomSpinEdit.GetMaxValue: integer;
function TCustomSpinEdit.GetMaxValue: Integer;
begin
Result:=round(FMaxValue);
end;
function TCustomSpinEdit.GetMinValue: integer;
function TCustomSpinEdit.GetMinValue: Integer;
begin
Result:=round(FMinValue);
end;
function TCustomSpinEdit.GetValue: integer;
function TCustomSpinEdit.GetValue: Integer;
begin
Result:=round(inherited GetValue);
end;
procedure TCustomSpinEdit.SetIncrement(const AValue: integer);
procedure TCustomSpinEdit.SetIncrement(const AValue: Integer);
begin
if Increment = AValue then exit;
inherited SetIncrement(AValue);
end;
procedure TCustomSpinEdit.SetMaxValue(const AValue: integer);
procedure TCustomSpinEdit.SetMaxValue(const AValue: Integer);
begin
if MaxValue=AValue then exit;
inherited SetMaxValue(AValue);
end;
procedure TCustomSpinEdit.SetMinValue(const AValue: integer);
procedure TCustomSpinEdit.SetMinValue(const AValue: Integer);
begin
if MinValue=AValue then exit;
inherited SetMinValue(AValue);
end;
procedure TCustomSpinEdit.SetValue(const AValue: integer);
procedure TCustomSpinEdit.SetValue(const AValue: Integer);
begin
if Value=AValue then exit;
inherited SetValue(AValue);

View File

@ -71,8 +71,8 @@ type
public
constructor Create(TheOwner: TComponent); override;
function GetLimitedValue(const AValue: Double): Double; virtual;
function ValueToStr(const AValue: Double): String; virtual;
function StrToValue(const S: String): Double; virtual;
function ValueToStr(const AValue: Double): string; virtual;
function StrToValue(const S: string): Double; virtual;
public
property DecimalPlaces: Integer read FDecimals write SetDecimals default DefDecimals;
property EditorEnabled: Boolean read FEditorEnabled write SetEditorEnabled default True;
@ -143,23 +143,23 @@ type
TCustomSpinEdit = class(TCustomFloatSpinEdit)
private
function GetIncrement: integer;
function GetMaxValue: integer;
function GetMinValue: integer;
function GetValue: integer;
function GetIncrement: Integer;
function GetMaxValue: Integer;
function GetMinValue: Integer;
function GetValue: Integer;
protected
procedure SetMaxValue(const AValue: integer); overload; virtual;
procedure SetMinValue(const AValue: integer); overload; virtual;
procedure SetIncrement(const AValue: integer); overload; virtual;
procedure SetValue(const AValue: integer); overload; virtual;
procedure SetMaxValue(const AValue: Integer); overload; virtual;
procedure SetMinValue(const AValue: Integer); overload; virtual;
procedure SetIncrement(const AValue: Integer); overload; virtual;
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;
property MaxValue: integer read GetMaxValue write SetMaxValue default 0;
property Increment: integer read GetIncrement write SetIncrement default 1;
property Value: Integer read GetValue write SetValue default 0;
property MinValue: Integer read GetMinValue write SetMinValue default 0;
property MaxValue: Integer read GetMaxValue write SetMaxValue default 0;
property Increment: Integer read GetIncrement write SetIncrement default 1;
end;