I’m creating my in game UI and have a “stats” screen that is initially disabled. on the init script for the GUI is this:
local node = gui.get_node(“stats_box”)
gui.set_enabled(node, false)
This was based off the code in the http://www.defold.com/manuals/input/#_on_input page for the pause menu.
Now, the enabling works fine, but when I want to close the window, I’m just having the user click on it.
One thing I’ve noticed is that if the GUI is disabled, it still receives input events. I put in a print statement indicating when an event handler is called to determine this is happening. Is this by design? If so, why would a disabled element still receive input?
One other thing, I am still seeing the print statement output even if the GUI was never opened. using the “show” message in the on_input tutorial above, I do msg.post(".", “acquire_input_focus”) only when responding to that message, so I’m expecting that GUI to not have input focus.
In my collection, I do have the “stats” gui as an element of the collection, so it does get instantiated, however shouldn’t it NOT have input focus until I tell it to get input focus?
I’m just a little confused on why my UI is getting input.
Thanks.