Closed wgahnagl closed 3 years ago
Hello and thanks for your feedback! I think what you request is already possible :)
EditBox:clear_focus
. This allows the focus to be cleared when pressing the escape key. You can also call clear_focus
in other scripts (such as when pressing a "Submit" button associated to the edit box). Does that cover all your needs?Note that is_keyboard_focus()
is obviously only handling cases where the GUI swallows keyboard events. For mouse events, e.g., for cases where there's a GUI element under the mouse and you don't want click events to be registered in your game world, you should use https://github.com/cschreib/lxgui/blob/8de440b6ecb5663e5ca7c2b3fd6f3baa8639780f/gui/examples/sfml/main.cpp#L94-L98
I've pushed changes on master
so that clicking outside of an edit box removes its focus. Let me know if that does the trick for you.
thank you so much! I'll take a look soon! :ok_hand: :fire:
I haven't been able to reproduce the problem since this fix has been merged. Have you had a chance to look at it and confirm it on your end? Just so I can close this ticket.
I'll take silence for approval :)
Hello again! So I've hit my first issue with the library! It looks like writing text in the textbox is working fine, but you're unable to leave it once you've clicked on it! I'm not sure if that can be solved by writing lua scripts to work around it, or if it needs to be fixed in the library itself, but either way I'll take a look :ok_hand:
It would probably be good to be able to set a global "textbox focus" type thing that locks out all other keypresses while you're interacting with a textbox, and unsets the lockout when you click anywhere else.