From 53e90e5a82015e9112628a54e13c3674aabe59d9 Mon Sep 17 00:00:00 2001 From: lazarus-bart Date: Sat, 22 Aug 2020 16:37:11 +0000 Subject: [PATCH] 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 --- components/exctrls/source/exeditctrls.pas | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/components/exctrls/source/exeditctrls.pas b/components/exctrls/source/exeditctrls.pas index f6b9f6688..7d592e878 100644 --- a/components/exctrls/source/exeditctrls.pas +++ b/components/exctrls/source/exeditctrls.pas @@ -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.