-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make it possible for TextInput to emit a message when gaining/losing foccus. #819
Comments
An event for gaining focus should be relatively straightforward to add. However, the losing focus one is trickier mainly because the focused widget can be removed from the widget tree anytime and I imagine users would expect the event to trigger in that case. That said, if you want to know if a specific |
How about a widget that that behaves like Using |
So I thought about this some more: An application, for example, a game, might want to keep track of which keys are currently pressed. If a So I think its not sufficient to just forward the un-captured events to the application's input management. I think something like a (Please correct me, if I am wrong) |
I had a problem probably related to this, I wanted to close a window on pressing ESC but when the text input was focused the update event loop did not get the KeyPressed event. I did find a workaround by listening to the KeyReleased event though. |
For me the problem has been resolved because #1230 was merged. |
Seems quite different from this issue. You seem to always want to receive the ESC event independent of whether a text input is focused, or do I misunderstand? |
yes, but as the textinput is the only thing present, listening for it loosing focus is also fine. |
This could be useful when using iced with an existing wgpu application like in the
integration
example.Imagine that the wgpu application is supposed to react to some keyboard inputs (for example W A S D to move the camera) and that the iced GUI on top of it has some
TextInput
.It would be useful to know in the main loop if of the TextInput is focused so that, in that case the keyboard events would not be forwarded to the wgpu app but only to the iced GUI.
Currently this can be achieved by asking the iced GUI, to check the state of all of its
TextInput
but I think emitting a message would make it easier.The text was updated successfully, but these errors were encountered: