ExCtrls: Adapt CurrencyEdit to recent changes in Laz-trunk (r64334, t64335)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7957 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-01-04 20:51:58 +00:00
parent 86003527b0
commit 3ee6c35043

View File

@@ -47,7 +47,6 @@ type
FDecimalSeparator: Char; FDecimalSeparator: Char;
FNegCurrencyFormat: TSpinEditNegCurrencyFormat; FNegCurrencyFormat: TSpinEditNegCurrencyFormat;
FThousandSeparator: Char; FThousandSeparator: Char;
function IsIncrementStored: Boolean;
procedure SetCurrencyFormat(AValue: TSpinEditCurrencyFormat); procedure SetCurrencyFormat(AValue: TSpinEditCurrencyFormat);
procedure SetCurrencyString(AValue: String); procedure SetCurrencyString(AValue: String);
procedure SetDecimals(AValue: TSpinEditCurrencyDecimals); procedure SetDecimals(AValue: TSpinEditCurrencyDecimals);
@@ -56,6 +55,9 @@ type
procedure SetThousandSeparator(AValue: Char); procedure SetThousandSeparator(AValue: Char);
protected protected
procedure EditKeyPress(var Key: char); override; procedure EditKeyPress(var Key: char); override;
function IncrementStored: Boolean; override;
function MaxValuestored: Boolean; override;
function MinValuestored: Boolean; override;
function SafeInc(AValue: Currency): Currency; override; function SafeInc(AValue: Currency): Currency; override;
function SafeDec(AValue: Currency): Currency; override; function SafeDec(AValue: Currency): Currency; override;
function TextIsNumber(const S: String; out ANumber: Currency): Boolean; override; function TextIsNumber(const S: String; out ANumber: Currency): Boolean; override;
@@ -68,7 +70,6 @@ type
procedure ResetFormatSettings; procedure ResetFormatSettings;
function StrToValue(const S: String): Currency; override; function StrToValue(const S: String): Currency; override;
public public
property Increment stored IsIncrementStored;
property CurrencyFormat: TSpinEditCurrencyFormat property CurrencyFormat: TSpinEditCurrencyFormat
read FCurrencyFormat write SetCurrencyFormat; read FCurrencyFormat write SetCurrencyFormat;
property CurrencyString: String property CurrencyString: String
@@ -323,6 +324,22 @@ begin
if (Key = '-') and IsLimited and (MinValue >= 0) then Key := #0; if (Key = '-') and IsLimited and (MinValue >= 0) then Key := #0;
end; end;
function TCustomCurrSpinEditEx.IncrementStored: Boolean;
begin
Result := FIncrement <> 1;
end;
function TCustomCurrSpinEditEx.MaxValueStored: Boolean;
begin
Result := FMaxValue <> 0;
end;
function TCustomCurrSpinEditEx.MinValueStored: Boolean;
begin
Result := FMinValue <> 0;
end;
procedure TCustomCurrSpinEditEx.ResetFormatSettings; procedure TCustomCurrSpinEditEx.ResetFormatSettings;
begin begin
FDecimals := DefaultFormatSettings.CurrencyDecimals; FDecimals := DefaultFormatSettings.CurrencyDecimals;
@@ -333,11 +350,6 @@ begin
FThousandSeparator := DefaultFormatSettings.ThousandSeparator; FThousandSeparator := DefaultFormatSettings.ThousandSeparator;
end; end;
function TCustomCurrSpinEditEx.IsIncrementStored: Boolean;
begin
Result := FIncrement <> 1;
end;
function TCustomCurrSpinEditEx.SafeInc(AValue: Currency): Currency; function TCustomCurrSpinEditEx.SafeInc(AValue: Currency): Currency;
begin begin
if (AValue > 0) and (AValue > MaxCurrency-FIncrement) then if (AValue > 0) and (AValue > MaxCurrency-FIncrement) then