0 votes
func _on_CheckButton_toggled(button_pressed):
    if button_pressed:
        $CheckButton.set_pressed(false)
    else:
        $CheckButton.set_pressed(true)

This function is connected with the toggled signal of the checkbutton. But when I click on the checkbutton, this error happens on the debugger:

Stack Overflow (Stack Size: 1024)

Godot version 3.4.2
in Engine by (64 points)

2 Answers

0 votes

Solved by me!

func _process(delta):
    for i in self.get_children():
        if i is CheckButton:
            if $Label_Status_Valor.get_text() == "STATUS_PENDING_VALUE":
                i.set_disabled(false)
            else:
                i.set_disabled(true)
by (64 points)
0 votes

Stack overflow means that there is almost endless loop somewhere in code. Setting pressed to false in code triggers toggled signal again, which sets pressed to false and so on. Easiest way out is to use BUTTONPRESSED signal instead and setdeferred("pressed",false). Buttonpressed signal should be emitted once on being clicked, buttontoggled emits every time its state is changed from pressed to unpressed and vice versa.

by (5,176 points)
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.