+1 vote

I have a scene setup as the following.


All 3 containers have 'Shrink Center' as horizontal and vertical size flags.

I dynamically insert other instanced scenes into the hbox_container and also remove them from time to time using script.

My intended behavior is that the panel_container as well as the hbox_container will resize themselves to the smallest possible rect.

It acts as expected when I insert new children, and both panel_container and hbox_container expands to accommodate them. However, when I remove them, they don't shrink back and remain at the last expanded size. Only when I insert new children they change to appropriate size.

How do I force the containers to recalculate size upon removing children?

asked Aug 7, 2018 in Engine by mr746866 (13 points)

1 Answer

0 votes

My trick for forcing a control to update itself is to hide() and then immediately show() it. Not sure if that works here, fingers crossed :)

answered Oct 6, 2018 by markopolo (618 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.