0 votes

Hi,

as the title says I have a hopefully small GUI tutorial that can't I solve by myself.

So currently my scene looks like this:

enter image description here

And as you can see from the image the focus_enter signal was connected to the main_menu node, which contains the following script:

extends Control

func _ready():
    print("created")

func buttonWasPressed():
    print("pressed")

func buttonWasFocused():
    print("focus")

But for some reason, the focus function never get's triggered In my script and I don't know why. Also the button node in the hierachy("entry") never get any focus and with that, doesn't change his appearance to the hover image or throwing the "pressed" signal. Any idea why?

Here are the settings for the main_menu_size node which basicly are the settings for the other nodes too:

enter image description here

PS: What exactly does the "Stop Mouse" function do? Prevent that the mouse signal goes to the child nodes?

in Engine by (186 points)
edited by

3 Answers

0 votes

You made a typo.
The focus function never gets called because the node connection is trying to call main_menu :: buttonWasFocued, while your script contains buttonWasFocused.

by (27,820 points)

Oh wow, how couldn't I saw this ... Okay changed it but the function still don't get called for some reason. But shouldn't the debugger also throw an error, if the connected signal doesn't exist? Or only if he tries call the signal, which then would also indicate why I didnt't see the typo.

The signal now looks like this:
enter image description here

0 votes

Make sure to call

    set_focus_mode(Control.FOCUS_ALL)
by (306 points)
0 votes

Okay nevermind found the problem.

The Node "fade_screen" had also the size of 1920x1080 and it seems with that it has "eaten" the focus of the top nodes, but thanks for the help :)

by (186 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.