[kovarex] [0.17.45][Modded GUI] "Enter" key sets selected state for focused LuaGuiElement button

This subforum contains all the issues which we already resolved.
eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

[kovarex] [0.17.45][Modded GUI] "Enter" key sets selected state for focused LuaGuiElement button

Post by eduran »

When hitting Enter or Return (assuming they are not bound via control settings) while a LuaGuiElement of type button is focused, that button shows its selected_graphical_set. No event is triggered and the button keeps the selected appearance until you press Enter/Return again. It is my understanding that 'selected' is not meant to be useable by modded GUI elements.

To reproduce execute

Code: Select all

/c game.player.gui.center.add{type = "button", caption = 'Hit the "Enter" key!'}.focus()
and press 'Enter' (the key on the numpad). Return is by default bound to 'Enter vehicle', but shows the same behavior when unbound.

As an example, this is what can happen when custom button styles are used:
buggy_buttons.jpg
buggy_buttons.jpg (76.52 KiB) Viewed 2990 times
kovarex
Factorio Staff
Factorio Staff
Posts: 8207
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [kovarex] [0.17.45][Modded GUI] "Enter" key sets selected state for focused LuaGuiElement button

Post by kovarex »

Thanks for the report.
It was fixed for the next version by removing the tabable functionality from everything but textboxes.
eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: [kovarex] [0.17.45][Modded GUI] "Enter" key sets selected state for focused LuaGuiElement button

Post by eduran »

Thanks for having a look. However, this only solves the most common cause of the problem, not the underlying problem itself. It is still possible to focus buttons with the focus() method or the mouse. If you then hit Enter/Return, the button is toggled into the selected state and stays that way. I would expect it to act as if clicked (or not at all).
You can notice the difference if you run the code I posted above. Click the button and it only stays clicked while LMB is pressed (as it should). Hit Enter and the button toggles permanently.
Post Reply

Return to “Resolved Problems and Bugs”