-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
number_input, unable to type non-integer numbers. #234
Comments
I tried to do this, when I reworked a few number_input things some time ago and there is one edge case I could not solve. The problem becomes appending a dot, because the current value always has to be a valid number. Let say the current number is I only realy see two ways to make this work here.
If either of them seem like a useable solution for the time being, I could add them, but I feel like they are both not great, which is why I gave up this initially In theory there might be a 3. option involving decoupeling the text_input state&on_changed from the number_inputs, but that seems like a hard and error prone thing do do |
yeah the issue here is ignore or not. I think not ignoring might be better since on the visual side we can make it appear as with just the dot but on the numeric side we can append a .0. This generally will be better for floating point numbers. as auto placing it on the string can mess up someones typing of a number if they have not finished yet. the only other way would be to make it focused and when enter is hit to make it unfocused then to do the .0 addition and such and not check the number till then. Downside to this is you need to handle the max and min by manually clamping the number after parsing it and then changing the string to what fits. |
Do negative numbers work? I'm unsure if your able to parse the |
I guess we can always do
|
To fix these I tried to add a 0 at the end of a number that ends with a point and let the from_str method do its job to tell me if it's valid or not. |
The only thing we could do here Is to enforce the String to be different from the T value that is returned. This way, it doesn't matter if the String is 1.0 or 1. As they would both be the same, just displayed differently. |
Good afternoon.
With the number_input, I am unable to type non-integer numbers. On the example provided for use of the widget, I can obtain
10.5
for example if I press the arrow up or scroll.However, if I try to type it, I am unable to.
I think the cause is that the dot is parsed and removed before I can type what goes after it. Furthermore, I can also input a non-integer number if I type it elsewhere and copy and paste it into the application.
I don't know wether I have to enable a setting I am unaware of or if this is unimplemented functionality.
Thank you for everything.
Kind regards.
The text was updated successfully, but these errors were encountered: