Button pressed signal still trigger when disabled and remove_child

Godot Version



Hi I am working a CanvasLayer with two Panels overlap each other (I want to have a multi-page form) and the next button in first panel is overlap with save button in second panel. Only first panel is shown beginning and when press next in first panel, it will go to second panel(hide the first panel and set second panel visible).

My first attempt is using visible = false to hide the panel, but the button still triggers

Second attempt set the MOUSE_FILTER_STOP and MOUSE_FILTER_IGNORE but still the click go into second panel when pressing the next button in first panel

Then I tried save_button.disabled but somehow the function still get triggered

I even tried remove_child(panel2) and I checked the Remote session during debug that the second panel is not displayed in scene tree but the save_button function still get triggered when press the next button in first panel
My current solution is:
func _on_save_button_pressed():
if save_button.disabled == false:
## custom logic
In this case , it didn’t run into the code, but still I am very confused about the entire thing

Does anyone know where was the issue, and also any other implementation of multipage form in Godot UI?

Sounds like some logic error. Maybe you connected the signals to the same function. Post more information, the scene tree, screenshots,…

Doing any of the changes you did should work fine.

  • Non visible Controls won’t consume any input event.
  • Controls with MOUSE_FILTER_IGNORE won’t consume any mouse event.
  • Enabling Button.disabled will consume the mouse event but won’t trigger the Button.pressed signal.

Turns out is my own problem, I copied the second panel and make adjustments for first panel, but I forgot to inlink the signals. I used a connect_signals function in _ready instead of using the UI to connect signals that’s why I missed the link there