-
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
Adding support for dots in number_input #267
Conversation
…s valid for the given type) Adding suport for dots in number input
…s valid for the given type) Adding suport for dots in number input
I'll fix the pipeline once I have feed back (to prevent doing such a small commit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good, but I'd need to test it first before pulling it in.
It could be interesting to make TypedInput able to have a different style when the entry is invalid, but I don't understand well enough this part of iced to do it |
Ok this is a decent update that does fix the issue. However, there was one issue I noticed that needs to be fixed before I can merge this. When using an u32 and setting the range from 0..250 I should be able to type 249, but I can not and can only type up to 248. Please fix this issue then I can merge it. |
I think I know where it comes from (using |
if Max is ..250 then it should go to 249 if max is ..=250 then it should go to 250. ATM I set it as ..250 so it should allow typing in 249 but I am only getting 248 as a max to type in. |
I agree with what you are saying My question was, wouldn't be better to store the bound using a type implementing RangeBounds. |
the reason is to allow all Range's to work with this so the end user can dictate how they want their min and max's to be like. |
Isn't what RangeBounds supposed to work ? |
you just need to resolve the format issue by running cargo fmt |
Should fix #234
To fix it, I created a new widget, the TypedInput, it allows the user to write anything in a TextInput, but only send messages when it is a correct value, and then the message contain this value (not the string).
I then modify NumberInput to use this widget instead of a standard TextInput.
My code may not be the cleanest or respect all the guideline of the repo, so I'll be happy to edit it according to your liking.