-
Notifications
You must be signed in to change notification settings - Fork 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
Allow enter to select items from combobox's list. #6570
Conversation
@SmallJoker Rebased |
Do you know of a mod which allows me to test it? |
minetest.register_chatcommand("z", {
func = function(name, param)
minetest.show_formspec(name, "z", "size[5,1]\ndropdown[0,0;5;test;A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;1]")
end,
})
minetest.register_on_player_receive_fields(function(p, formname, fields)
if formname == "z" then minetest.chat_send_all(fields.test or 'nil') end
end) With the patch you can click the combo-box and enter a letter on the keyboard then press enter to select. The correct letter will show in chat. Without the patch, doing the above will close the form and previously selected letter will remain. |
Thanks. |
@@ -3000,7 +3000,8 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event) | |||
gui::IGUIElement *focused = Environment->getFocus(); | |||
if (focused && isMyChild(focused) && | |||
(focused->getType() == gui::EGUIET_LIST_BOX || | |||
focused->getType() == gui::EGUIET_CHECK_BOX)) { | |||
focused->getType() == gui::EGUIET_CHECK_BOX) && |
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.
Indentation looks weird, please remove any spaces.
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's logical, as it's within the parentheses.
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.
I know it's done to line stuff up, but we have a strict rule to never use spaces in indentation.
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.
LGTM
Only RETURN should select, Escape / Cancel / Inventory keys should continue to close the form. |
No response to requests for a month, closing for now. |
Currently if you use the keyboard to search though a combobox and try to select an item with enter, it will close the form without sending the update.