# A few questions about gui and vscode (SOLVED)

**URL:** <https://forum.defold.com/t/a-few-questions-about-gui-and-vscode-solved/64133>\
**Category:** Questions\
**Created:** [December 20, 2019, 7:29pm UTC](https://forum.defold.com/t/a-few-questions-about-gui-and-vscode-solved/64133 "2019-12-20T19:29:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dat\_Indie](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dat_indie/32/18548_2.png) [@Dat\_Indie](https://forum.defold.com/u/Dat_Indie)\
**Post date:** [December 20, 2019, 7:29pm UTC](https://forum.defold.com/t/a-few-questions-about-gui-and-vscode-solved/64133/1 "2019-12-20T19:29:26Z")

</div>

Hello there!  
Sorry, first post with some questions already.

1. GUI related. I’m using the gui.set\_enabled() to disable my container (after pressing the start button) that contains two elements: a button (gooey) and a box (background). Calling the method only removes the first one. I couldn’t find anything related in Defold’s documentation.  
 ![yo](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/e/8/e8aa38d6d9faea97d0da15091da6fbe65031bbe1.gif)

2. and how can I open files from external libraries (like gooey) using vscode? I think the only way to do it is downloading and setting up the libraries manually idk.

Thanks!

---

<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:** [December 21, 2019, 8:01am UTC](https://forum.defold.com/t/a-few-questions-about-gui-and-vscode-solved/64133/2 "2019-12-21T08:01:21Z")

</div>

> [@Dat\_Indie](#):
>
> Calling the method only removes the first one.

Can you double check that the node you disable is the root node and that all others are children?

> [@Dat\_Indie](#):
>
> how can I open files from external libraries (like gooey) using vscode?

The library dependencies are zip files in the .internal folder. The Defold editor will show them as it is designed to do so, but VSCode obviously doesn’t know about them.

---

<div class="post-metadata">

**Author:** ![Dat\_Indie](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dat_indie/32/18548_2.png) [@Dat\_Indie](https://forum.defold.com/u/Dat_Indie)\
**Post date:** [December 21, 2019, 10:30am UTC](https://forum.defold.com/t/a-few-questions-about-gui-and-vscode-solved/64133/3 "2019-12-21T10:30:57Z")

</div>

> [@britzl](#):
>
> Can you double check that the node you disable is the root node and that all others are children?

yep background it’s definitely a child of container.  
 ![eee](https://forum-defold-uploads.b-cdn.net/original/3X/7/4/747e7522ee9f23004fec790bcd379f4f46bbc41e.gif)  
_script_

 ![42](https://forum-defold-uploads.b-cdn.net/original/3X/1/b/1bf64dd488c6e8094103a124ed9ec47444d7c75f.png)

> [@britzl](#):
>
> The library dependencies are zip files in the .internal folder. The Defold editor will show them as it is designed to do so, but VSCode obviously doesn’t know about them.

Oh I see. Thanks!

---

<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:** [December 21, 2019, 4:02pm UTC](https://forum.defold.com/t/a-few-questions-about-gui-and-vscode-solved/64133/4 "2019-12-21T16:02:34Z")

</div>

> [@Dat\_Indie](#):
>
> yep background it’s definitely a child of container

Can you isolate this problem into a small project so that we can take a look?

---

<div class="post-metadata">

**Author:** ![Dat\_Indie](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dat_indie/32/18548_2.png) [@Dat\_Indie](https://forum.defold.com/u/Dat_Indie)\
**Post date:** [December 21, 2019, 7:00pm UTC](https://forum.defold.com/t/a-few-questions-about-gui-and-vscode-solved/64133/5 "2019-12-21T19:00:30Z")

</div>

[example.zip](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/5/7/5755172b4afb735cb6e1ee3f3c634613f088b0a4.zip) (582.4 KB)

GUI copied from my main project. Error persist. I just followed the same steps on a new project and worked. I don’t know what Im missing. I’m sorry if this is some trivial thing =/

---

<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:** [December 21, 2019, 9:06pm UTC](https://forum.defold.com/t/a-few-questions-about-gui-and-vscode-solved/64133/6 "2019-12-21T21:06:24Z")

</div>

Ah, found the problem. The things is that as opposed to the lifecycle functions the callback from the Gooey button press doesn’t start with self. The first value is the button table structure itself:

```lua
local function hide(self)
	gui.set_enabled(self.node, false)
end

function on_input(self, action_id, action)
	gooey.button("start/bg", action_id, action, hide)
end

```

You are treating the first value passed to hide() as the script reference when in fact it is the button data structure (refer to Gooey button docs: [GitHub - britzl/gooey: Defold GUI system · GitHub](https://github.com/britzl/gooey#gooeybuttonnode_id-action_id-action-fn-refresh_fn)).

And it just happens that the button data structure has a value called `node` which references the root node of the button. This is why the call to gui.set\_enabled() doesn’t fail and only the button is hidden. Change to this:

```lua
function on_input(self, action_id, action)
	gooey.button("start/bg", action_id, action, function(button)
		gui.set_enabled(self.node, false)
	end)
end

```

---

<div class="post-metadata">

**Author:** ![Dat\_Indie](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dat_indie/32/18548_2.png) [@Dat\_Indie](https://forum.defold.com/u/Dat_Indie)\
**Post date:** [December 21, 2019, 9:21pm UTC](https://forum.defold.com/t/a-few-questions-about-gui-and-vscode-solved/64133/7 "2019-12-21T21:21:35Z")

</div>

Ahh makes sense now. It’s working, thank you! Ill read more carefully the libraries docs from now on (or even debug what Im send thought those methods). Sorry to bother and thanks again!
