Formspec: change tabs with ctrl+tab#16167
Conversation
|
Quick review. I like this feature and also wonder why no-one else has yet come up with this... |
|
Thanks for the review and the kind words. I was wondering the same! Edit: The only issue I found can be seen e.g. in devtest in the "Tabs" tab, where instead of the test_formspec tabs it will focus the tabs inside of that page. Similar behavior happening in the "Real Coord" tab. |
SmallJoker
left a comment
There was a problem hiding this comment.
The tab control is not always selected correctly, but generally there's at most one, which makes it tolerable.
I tried to fix that by checking the parent of the focused element - but tab controls are apparently only used for visuals and not to actually contain elements (as it would be intended by the Irrlicht API). I suppose the current solution must suffice.
Isn't that worth opening an issue for (maybe even just to document it)? |
It's an implementation detail. Formspecs could be made more responsive but I wonder whether that would justify additional traffic (to send all tab contents in the same formspec),. |
This PR adds the ability to switch to the next/previous tab using ctrl(+shift) +tab.
Note: I have used AI during development.
Goal of the PR
Make it easier/quicker to go to the next/previous tab using keyboard controls.
How does the PR work?
It modifies the
GUIFormSpecMenu'sOnEventmethod to cycle through tabs using the above mentioned keyboard shortcut.There are also a few event handling refinements:
GUIFormSpecMenu'spreprocessEventmethod to preventCtrl+TabandReturnkeys from being incorrectly consumed by child elements like checkboxes, tables, and list boxes.GUITableto pass key events with theControlmodifier to its parent, ensuring consistent event propagation.GUITable'sOnEventmethod to no longer consume theSpacekey, allowing it to pass to the parent element instead.Does it resolve any reported issue?
Not any that I am aware of.
Does this relate to a goal in the roadmap?
Hopefully 2.3.
If not a bug fix, why is this PR needed? What usecases does it solve?
It makes it easier and quicker to go to the next or previous tab.
To do
This PR is ready for Review.
Preview
2025-05-26.20-05-54.mp4
How to test
Open Luanti → try switching forth and back using the keyboard shortcut.