Jump to content
Sign in to follow this  
Perpeto

Bug in TNumberBox: i cannot override a negative Number, if i type "-" in

Recommended Posts

1. Add TNumberbox anywhere

2. Set Mode to "nbmFloat"

3. Enter a negative Number like "-1.234"

4. Select whole number and press "-" ... nothing happens, besides it would override the value

 

Imo the issue is here:

function TCustomNumberBox.IsValidChar(AKey: Char): Boolean;
begin
..
if (AKey = '-') and ((SelStart <> 0) or LText.Contains('-')) then
      Result := False
..
end;

It tests, if the string already has an "-". But it does not test, if the whole string is selected, i.e. the user wants to override the whole value.

 

Can anyone reproduce this too or tell me, if I am wrong? Otherwise I would create a bug report for this. Thanks!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×