Page 1 of 1

LuaGuiElement textfield: confirm_on_focus_lost

Posted: Thu Aug 01, 2019 3:39 am
by raiguard
Hello. With all of the new textfield additions (THANK YOU!!!), there are still two things missing that would complete my needs 100%, one of which is the option for the textfield to confirm when its focus is lost. Think of it as the opposite of the lose_focus_on_confirm option.

The reason I want this is to avoid confusion for players who, instead of pressing enter, click another GUI element to defocus the textfield. As you can see in this video, doing the latter does not fire the confirmed event, and therefore the cheat is not edited:



The most elegant solution I can think of for this is for a textfield to optionally fire the on_gui_confirmed event when it loses focus like this.

Thanks for your time!

Re: LuaGuiElement textfield: confirm_on_focus_lost

Posted: Thu Aug 01, 2019 4:13 am
by Rseding91
This isn't going to happen. Losing focus can happen for one of many reasons - even destroying the game when exiting can trigger focus lost. It's not an explicit user input and the base game specifically never treats "focus lost" as confirmation.

If that's the behavior you want - you're out of luck - because it's not going to happen.

Re: LuaGuiElement textfield: confirm_on_focus_lost

Posted: Thu Aug 01, 2019 4:17 am
by raiguard
Fair enough, thanks anyway!

Re: LuaGuiElement textfield: confirm_on_focus_lost

Posted: Fri Nov 22, 2019 11:06 pm
by jockeril
Hello Rseding,

Is there a way to have the input stick when we leave the text field if not like this - I and many other players have found this to be an issue in other mods as well like in this hellmod discussion about changing the amount of modules used in a line or block,

This behaviour is natural - you set a number and move on to the next item - can't there be a way to accept the last text in the field as the value of that field ?

Thank you !

Re: LuaGuiElement textfield: confirm_on_focus_lost

Posted: Tue May 04, 2021 7:04 pm
by Xorimuth
Rseding91 wrote:
Thu Aug 01, 2019 4:13 am
This isn't going to happen. Losing focus can happen for one of many reasons - even destroying the game when exiting can trigger focus lost. It's not an explicit user input and the base game specifically never treats "focus lost" as confirmation.

If that's the behavior you want - you're out of luck - because it's not going to happen.
In the train time select GUI, the textfield contains "30 s", when you click it, it turns into "30" and when it loses focus it goes back to "30 s". It would be nice to be able to replicate this, but it isn't possible without this suggestion being implemented. :?