• Godot Help
  • How to make a parent VBoxContainer shrink when child scene shrinks?

The red text and red icon is a HBoxContainer. Sometimes the HBoxContainer is normally hidden. It's the error bar/panel here:

When it is shown the parent VBoxContainer expands, when it is hidden the VBoxContainer contracts. But...

Because this special HBoxContainer needs to appear in many places, I moved this HBoxContainer into its own scene, (let's call it the "Error Bar Scene"). Inside it has code to set itself visible = false or visible = true.

Now when this new scene grows, the VBoxContainer does expand, but when it shrinks itself it doesn't contract the parent VBoxContainer.

What do I need to do to make it so when a scene wants to hide itself, it tells the parent scene that it updated its size?

extends Control

export var failure_message_timeout = 4

signal fail_message_done

func _ready():
	clear()

func clear():
	$FailedPanel.visible = false
	self.visible = false

func failed(message):
	$HideTimer.stop()
	$FailedPanel.visible = true
	self.visible = true
	$FailedPanel/Label.text = message
	$HideTimer.wait_time =  failure_message_timeout
	$HideTimer.start()
	emit_signal("fail_message_done")

Pardon me if I mistook your question.
There is a hide() signal in Canvas Item, it will emit when the node becomes hidden.
Does it help that connect your VBoxContainer to your child node's hide() signal and shrink itself to the right size when the signal is emitted?

I do assume the issue is something to do with when the child scene is hidden/resized, this info is not propagating up to the parent VBoxContainer. The problem is I don't know which signal is not getting through, is it a child inside the child scene needing to notify the scene node, or is it the scene node not propagating up outside into the parent VBoxController. Very confusing.

might it be that a hidden node gets muted and isn't firing it's signal? What if you manually trigger the signal?