ExCtrls: Adapt currency edit to recent changes in LazControls due to issue #39490/39491.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8181 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-12-17 15:16:39 +00:00
parent 2955c1d4a9
commit f70da64217

View File

@@ -47,8 +47,6 @@ type
FDecimalSeparator: Char;
FNegCurrencyFormat: TSpinEditNegCurrencyFormat;
FThousandSeparator: Char;
function IncrementStored: Boolean;
function MaxValueStored: Boolean;
procedure SetCurrencyFormat(AValue: TSpinEditCurrencyFormat);
procedure SetCurrencyString(AValue: String);
procedure SetDecimals(AValue: TSpinEditCurrencyDecimals);
@@ -59,6 +57,9 @@ type
procedure EditKeyPress(var Key: char); override;
function SafeInc(AValue: Currency): Currency; override;
function SafeDec(AValue: Currency): Currency; override;
{$IF FPC_FullVersion=30202}{$IFDEF Win64}
function SameValue(AValue1, AValue2: Currency): Boolean; override;
{$ENDIF}{$IFEND}
function TextIsNumber(const S: String; out ANumber: Currency): Boolean; override;
function TryExtractCurrency(AText: String; out AValue: Currency;
const AFormatSettings: TFormatSettings): Boolean;
@@ -81,8 +82,6 @@ type
read FNegCurrencyFormat write SetNegCurrencyFormat;
property ThousandSeparator: Char
read FThousandSeparator write SetThousandSeparator;
property Increment stored IncrementStored;
property MaxValue stored MaxValueStored;
end;
{ TCurrSpinEdit }
@@ -313,6 +312,7 @@ begin
FIncrement := 1;
FMaxValue := 0;
FMinValue := 0; // --> disable Max/Min check by default
FValue := 0;
ResetFormatSettings;
end;
@@ -326,16 +326,6 @@ begin
if (Key = '-') and IsLimited and (MinValue >= 0) then Key := #0;
end;
function TCustomCurrSpinEditEx.IncrementStored: Boolean;
begin
Result := FIncrement <> 1;
end;
function TCustomCurrSpinEditEx.MaxValueStored: Boolean;
begin
Result := FMaxValue <> 0;
end;
procedure TCustomCurrSpinEditEx.ResetFormatSettings;
begin
FDecimals := DefaultFormatSettings.CurrencyDecimals;
@@ -362,6 +352,14 @@ begin
Result := AValue - FIncrement;
end;
// Workaround for https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39490
{$IF FPC_FullVersion=30202}{$IFDEF Win64}
function TCustomCurrSpinEditEx.SameValue(AValue1, AValue2: Currency): Boolean;
begin
Result := (AValue1 = AValue2);
end;
{$ENDIF}{$IFEND}
procedure TCustomCurrSpinEditEx.SetCurrencyFormat(AValue: TSpinEditCurrencyFormat);
begin
if AValue = FCurrencyFormat then exit;