mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 20:40:25 +02:00
LazControls: allow input in scientific notation in TFloatSpinEditEx.
git-svn-id: trunk@63697 -
This commit is contained in:
parent
289c03ff79
commit
f45054d487
@ -372,15 +372,16 @@ end;
|
|||||||
procedure TCustomFloatSpinEditEx.EditKeyPress(var Key: char);
|
procedure TCustomFloatSpinEditEx.EditKeyPress(var Key: char);
|
||||||
begin
|
begin
|
||||||
inherited EditKeyPress(Key);
|
inherited EditKeyPress(Key);
|
||||||
{Disallow any key that is not a digit, decimalseparator or '-'
|
{
|
||||||
|
Disallow any key that is not a digit, decimalseparator or '+', '-' or 'E/e'
|
||||||
For ease of use translate any decimalpoint or comma to DecimalSeparator
|
For ease of use translate any decimalpoint or comma to DecimalSeparator
|
||||||
Tab, BackSpace, Cut, Paste, Copy, Undo of course should be passed onto inherited KeyPress
|
Tab, BackSpace, Cut, Paste, Copy, Undo of course should be passed onto inherited KeyPress
|
||||||
If FDecimals = 0, disallow decimalseparator also
|
If FDecimals = 0, disallow decimalseparator also
|
||||||
}
|
}
|
||||||
if (Key in ['.',',']) then Key := FFS.Decimalseparator;
|
if (Key in ['.',',']) then Key := FFS.Decimalseparator;
|
||||||
if not (Key in (Digits + AllowedControlChars + [FFS.DecimalSeparator,'-'])) then Key := #0;
|
if not (Key in (Digits + AllowedControlChars + [FFS.DecimalSeparator,'-','+','e','E'])) then Key := #0;
|
||||||
if (Key = FFS.DecimalSeparator) and (FDecimals = 0) then Key := #0;
|
if (Key = FFS.DecimalSeparator) and (FDecimals = 0) then Key := #0;
|
||||||
if (Key = '-') and IsLimited and (MinValue >= 0) then Key := #0;
|
//if (Key = '-') and IsLimited and (MinValue >= 0) then Key := #0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomFloatSpinEditEx.TextIsNumber(const S: String; out ANumber: Double
|
function TCustomFloatSpinEditEx.TextIsNumber(const S: String; out ANumber: Double
|
||||||
|
Loading…
Reference in New Issue
Block a user