Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | wombatTurkey | |
Old Version | Published before Godot 3 was released. |
VBoxContainer is wonderful because of its awesome layout positioning which is all automatic (for its children).
The dilemma is all the children added to the VBoxContainer
inherit the VBoxContainer's
width, not their own. For example what I have here is newly created panels that are added to a VBoxContainer, that disappear after xx seconds:
See how the width changes after each update? That’s because I wrote a dirty hack (dont use in production :P):
extends VBoxContainer
func _ready():
set_process(true)
pass
func _process(delta):
for node in get_children():
node.set_size(Vector2(node.get_custom_minimum_size().width, node.get_custom_minimum_size().height))
Which kind of overrides VBoxContainer's
auto width thing, but it looks nasty because of the refresh/update then gets overridden by VBoxContainer's
native layout.
So, with all that said is there anyway to maybe take advantage of VBoxContainer's
vertical
layout feature, but have custom minimum widths? Same could be said for the HBoxContainer
too. Thanks in advance