GUI and textfield focus
Posted: Thu Jun 23, 2022 8:58 am
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:
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?
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:
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?