What is the purpose of gui.set_enabled() (or Enabled in Properties)?

Why do we need Enabled if turning it off does not completely disable the node, but only its visibility? Which, in principle, is what Visible does as well.

After reading the GUI scenes in Defold and API reference (GUI) , I couldn’t find a clear answer. Except that it should do „If unchecked, the node is not rendered, not animated and can not be picked using .” but it doesn’t.

Whether Enabled is on or off, the node continues to work, except for its visual display. If you also turn off Visible, nothing will change.

There was also an old topic regarding this issue, but it did not specify how it should actually work

The documentation says the following:

Enabled
If unchecked, the node is not rendered, not animated and can not be picked using gui.pick_node(). Use gui.set_enabled() and gui.is_enabled() to programmatically change and check this property.

Visible
If unchecked, the node is not rendered, but can still be animated and picked using gui.pick_node(). Use gui.set_visible() and gui.get_visible() to programmatically change and check this property.

3 Likes

One important difference is that disabling a node will hide it’s child nodes as well, but setting visible to false will keep the child nodes visible. So you can hide a whole GUI screen by disabling the root node.

And you can also check is a node is enabled with gui.is_enabled(), and for example only apply button presses in on_input() if the node is enabled.

3 Likes