MrBounty / PZ-UI_API

UI API for the game project zomboid
18 stars 4 forks source link

Using :setEnterFunc() causes the game to freeze #10

Open toomanynights opened 8 months ago

toomanynights commented 8 months ago

If I assign an enter function to an entry field and then press "Enter", the game no longer responds to any key press. The only way to make it work again is to press any UI element with a mouse cursor.

Using the same function binded to "Enter", but some other way (i.e. via custom hotkey or a button) doesn't cause this problem.

toomanynights commented 8 months ago

To others concerned: it happens because Enter, unlike UIToggle(), doesn't remove focus from an entry field. To work around that, simply remove the focus yourself:

UI["newItemText"].javaObject:unfocus()