So I've been reading a bunch of posts on here that sound similar to my problem, but none of them seem to be fixing my issue.
In short, I have a VBoxContainer that is filled with buttons dynamically. I repeatedly add N buttons at once, and then remove them all when a button is selected. The buttons use Fill and Expand size flags to fill out the container when added, and they work fine when adding more buttons.
BUT, if I had let's say 5 buttons shown previously, and then I show 3 buttons afterwards, the container has now expanded vertically slightly and the bottom buttons are cut off.
On the buttons and containers I've tried toggling visible, setting rectsize and rectmin_size and resetting it, the only way I can programmatically get this thing to fix itself is by expanding the window by 20 pixels every time and then shrinking it again, but also only after delaying for a fraction of a second. Here's the fix I'm using:
OS.set_window_size(Vector2(OS.window_size.x, OS.window_size.y - 20))
OS.set_window_size(Vector2(OS.window_size.x, OS.window_size.y + 20))
There has to be a more elegant way to fix this - what happens internally when I resize the window? Can I manually call that?