Making Components leave the layout when invisible

It’s nice how we can control the visibility of a GuiItem by listening to a “property” controlled by a ToggleButton’s “value”. However, the bounds of the GuiItem are not affected - it just goes blank without affecting the layout otherwise. I would prefer that it completely disappear, giving its space to surrounding Components in a refreshed layout. Is there some easy way to accomplish this? I tried a few experiments in foleys_GuiItem.cpp and could not come up with a quick solution.

There is an easy way to do that, you make a class that has the wrap set to 0. By that the flexbox will assign no space to that component. Now you switch this class on and off to pop that component in or out the layout.

Hope that helps.

1 Like