# Gui.set\_enabled doesn't prevent gui.pick\_node in Input

**URL:** <https://forum.defold.com/t/gui-set-enabled-doesnt-prevent-gui-pick-node-in-input/28819>\
**Category:** Questions\
**Created:** [September 6, 2018, 7:39pm UTC](https://forum.defold.com/t/gui-set-enabled-doesnt-prevent-gui-pick-node-in-input/28819 "2018-09-06T19:39:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![selimanac](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/selimanac/32/6397_2.png) [@selimanac](https://forum.defold.com/u/selimanac)\
**Post date:** [September 6, 2018, 7:39pm UTC](https://forum.defold.com/t/gui-set-enabled-doesnt-prevent-gui-pick-node-in-input/28819/1 "2018-09-06T19:39:57Z")

</div>

When I disable the gui node with gui.set\_enabled false, it is still available for pick\_node in Input.  
Is this the excepted behavior?

In my case it is a box node as button. Node is not rendered but it is clickable:

```lua
function init(self)
	...
	gui.set_enabled(my_button, false)
	...
end

function on_input(self, action_id, action)
	if action_id == hash("touch") and action.pressed then 
		if gui.pick_node(my_button, action.x, action.y) then 
			print("click")
		end
	end
end

```

---

<div class="post-metadata">

**Author:** ![decoded](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/decoded/32/7134_2.png) [@decoded](https://forum.defold.com/u/decoded)\
**Post date:** [September 6, 2018, 11:40pm UTC](https://forum.defold.com/t/gui-set-enabled-doesnt-prevent-gui-pick-node-in-input/28819/2 "2018-09-06T23:40:31Z")

</div>

You can check if the node is enabled using gui.is\_enabled(node)

```lua
if gui.pick_node(my_button, action.x, action.y) and gui.is_enabled(my_button) then 
	print("click")
end

```

It is a little confusing, as you would think disabling a node would disallow pick\_node on it. I thought so too initially.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [September 7, 2018, 4:16am UTC](https://forum.defold.com/t/gui-set-enabled-doesnt-prevent-gui-pick-node-in-input/28819/3 "2018-09-07T04:16:29Z")

</div>

It’s by design, but I can agree that it might be confusing before you know that is how it works. For nested view hierarchies it’s worth pointing out that you may wish to check if a parent is disabled as well:

> <https://github.com/britzl/gooey/blob/master/gooey/internal/core.lua#L55-L67>

---

<div class="post-metadata">

**Author:** ![selimanac](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/selimanac/32/6397_2.png) [@selimanac](https://forum.defold.com/u/selimanac)\
**Post date:** [September 7, 2018, 7:31am UTC](https://forum.defold.com/t/gui-set-enabled-doesnt-prevent-gui-pick-node-in-input/28819/4 "2018-09-07T07:31:47Z")

</div>

Thank you @britzl @decoded

---

<div class="post-metadata">

**Author:** ![Mitch](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/m/dec6dc/32.png) [@Mitch](https://forum.defold.com/u/Mitch)\
**Post date:** [April 23, 2019, 6:14pm UTC](https://forum.defold.com/t/gui-set-enabled-doesnt-prevent-gui-pick-node-in-input/28819/5 "2019-04-23T18:14:47Z")

</div>

> [@britzl](#):
>
> It’s by design, but I can agree that it might be confusing before you know that is how it works. For nested view hierarchies it’s worth pointing out that you may wish to check if a parent is disabled as well:

I ran into the same frustrating problem causing bugs with disabled GUI’s because I assumed disabling them would mean they are not pickable because they’re disabled. Easily solved by adding “gui.is\_enabled(node)” now that I found this thread. Might be worth adding to the documentation under either is\_enabled or set\_enabled to make it clearer disabled nodes are still pickable.

> gui.is\_enabled
> 
> Returns `true` if a node is enabled and `false` if it’s not. Disabled nodes are not rendered and animations acting on them are not evaluated.

> gui.pick\_node - determines if the node is pickable by the supplied coordinates

Disabled nodes are not rendered, ignore animations but are still pickable?
