I'm having a problem with a container that has issues with vertical expansion. It doesn't activate the scroll bars of scroll containers it sits inside. It does not expand and push other elements lower when sitting among other instances inside of a vboxcontainer.
I suspect I'm missing something in regards to changing the size of the container but it doesn't always push parent control nodes to expand to accommodate it's size and thus activate scrolling or pushing other elements.
I have a custom container that orders it's children with this function:
var max_width = rect_size.x
var row_height = min_row_height
var row_width = 0
var row_index = 0
for child in get_children():
if row_width + child.rect_size.x < max_width:
child.rect_position = Vector2(row_width, row_index * (row_height + margin.y))
row_width += child.rect_size.x + margin.x
row_index += 1
child.rect_position = Vector2(0, row_index * (row_height + margin.y))
row_width = child.rect_size.x + margin.x
if rect_size.y < (row_index + 1) * row_height:
rect_size.y = (row_index + 1) * row_height
It orders the dark boxes as it should and wraps them around when it hits the horizontal limit. It also adjusts the vertical height of the box to accommodate each row if needed.
Here is one container filled with boxes to excess where it should be causing a scroll wheel to appear since it is inside of a ScrollContainer:
Here are several of the same container that sits inside a VBoxContainer inside of a ScrollContainer. The scrollbar is there this time though for the whole thing. The first container is filled but doesn't expand and push it's siblings down like I would prefer.
Almost every element involved has their SizeFlags set to Fill and Expand at least vertically so I'm not sure what's happening. Perhaps I am not implementing something I should be with my custom Container?