GUI and textfield focus

Place to get help with not working mods / modding interface.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1274
Joined: Sun Oct 14, 2018 8:13 am
Contact:

GUI and textfield focus

Post by Pi-C »

I've made a GUI containing a table with textfields. In response to on_gui_click and on_gui_text_changed, I change the textfield's style to highlighting mode, and when on_gui_confirmed fires, I reset the style again. This works great, but …

If the player is typing into one textfield and presses <TAB>, the focus is moved away from the current textfield to the next one available. I don't mind that the first textfield still is highlighted -- that's as expected because I want to warn the player that there still are unconfirmed changes. But I'd really like to change the style of the newly selected textfield as soon as it gets the focus.

In the following screenshot, the textfield for the Spidertron has been highlighted because it was active but the changes have not yet been confirmed. The textfield of the Heavy Truck still has the normal style you get when focusing a textfield with the tabulator key:
Spidertron: changes
Spidertron: changes
gui_textfields.png (31.21 KiB) Viewed 88 times



In the light of threads like 92021, I suppose that will not be possible to detect when a textfield gets the focus. Or is there some secret way I could get it to work? :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding help”