-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Move keyboard focus with tab to any interactive widget #31
Comments
Switching between input fields with tab and shift-tab has now been implemented on |
Tested this today and it seems that I wonder if it would be possible to support for all widgets (such the way it works in a regular gui) and not just for input fields? |
That would be nice yes, but it is not very high on my priority list right now |
I think I will try to implement this unless it's too complicated. Any pointers before I start? |
Wow, that would be great! The feature that handles focus of I think first of all, let's split this into two tasks: A) tab also moves kb_focus to buttons, checkboxes, sliders etc Let's start with A, and postpone B until A is done. First we have some design problems: When clicking a We can give kb_focus to a TextEdit by clicking it. Can we give kb_focus to a checkbox or slider by clicking it? I strongly vote no on this one, as it would give add some weird accent to the last button you pressed all the time. Instead I propose that the only way to give kb_focus to a button is by using tab/shift-tab. What happens when a slider has kb_focus? Arrows to move the slider one pixel? Enter to edit the value? How do we toggle/click buttons? Enter? Space? As for the implementation: Look at For the accent: whatever style you go with, make sure it is stored in Good luck! If you want to discuss this in more detail, you can find me in the Egui discord channel at https://discord.gg/vY8ZGS292W |
Cool. Thanks! I agree with your thoughts on focus above, I will start to hack around and see where I end up and ping you on discord if needed :) |
Any new progress on this? It's something I need too, so I may take a crack at it. |
I haven't got around to do it 😞 if you want to take a stab at it that would be great! |
I'll poke it and try making some progress. Quick semi-related question,
though. I've never worked with immediate mode GUIs. I guess the way you
respond to widget changes is by checking their properties conditionally,
but if you wanted a separate piece of code that responds to all focus
changes, how is that done? Di you track the currently focused widget on
something like the context, then have code to poll that and react when
the value changes?
If that's accurate, has something like that been implemented already?
And if not, would it be best on the context, memory, or somewhere else?
I'll need it for my use case, so I want to get that right if it hasn't
already been done.
Thanks.
|
@ndarilek keyboard focus is indeed part of Basically what is needed for this issue is that all interactive widgets call |
I added the |
I'm gonna start working on this |
Awesome! Sorry I didn't manage to get around to do it, but real life has gotten a bit in the way :/ |
@emoon no worries, I know the feeling :) |
It would be great to have support for keyboard only navigation (i.e a concept of focused widget and the ability to move focus to another one) that would allow "tab" key for example to move to the next widget and "return" would act as press, etc.
This in return would make it quite easy to add gamepad support as it would just behave as a subset of a regular keyboard.
The text was updated successfully, but these errors were encountered: