ExCtrls: TCustomFloatSISpinEditEx: in Lazarus >= 2.1 override KeyAllowed instead of EditKeyPress.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7624 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
lazarus-bart 2020-08-22 16:37:11 +00:00
parent 38282db2af
commit 53e90e5a82

View File

@ -173,14 +173,21 @@ type
TSIPrefix = (Yotta,Zetta,Exa,Peta,Tera,Giga,Mega,kilo,kiloUC,One,
milli,micro,microU,microalt,nano,pico,femto,atto,zepto,yocto);
{ TCustomFloatSISpinEditEx }
TCustomFloatSISpinEditEx = class(TCustomFloatSpinEditEx)
private
function EndsWithSIPrefix(var S: String; out APrefix: TSIPrefix): Boolean;
protected
{$IF LCL_FullVersion < 2010000}
procedure EditKeyPress(var Key: char); override;
{$endif}
function TextIsNumber(const S: String; out ANumber: Double): Boolean; override;
public
function ValueToStr(const AValue: Double): String; override;
{$IF LCL_FullVersion >= 2010000}
function KeyAllowed(Key: Char): Boolean; override;
{$endif}
end;
TFloatSISpinEditEx = class(TCustomFloatSISpinEditEx)
@ -534,11 +541,12 @@ begin
end;
end;
end;
{$IF LCL_FullVersion < 2010000}
procedure TCustomFloatSISpinEditEx.EditKeyPress(var Key: char);
begin
if Assigned(OnKeyPress) then OnKeyPress(Self, Key);
end;
{$endif}
function TCustomFloatSISpinEditEx.TextIsNumber(const S: String; out ANumber: Double): Boolean;
var
@ -583,5 +591,12 @@ begin
end;
end;
{$IF LCL_FullVersion >= 2010000}
function TCustomFloatSISpinEditEx.KeyAllowed(Key: Char): Boolean;
begin
Result := True;
end;
{$endif}
end.