Godot Version
4.2.2
Question
How can I my elements in my HboxContainer like that
My scene
Can someone help me ?
4.2.2
How can I my elements in my HboxContainer like that
My scene
Can someone help me ?
You have two columns for layout, one for labels and one for inputs, the problem is the width of the two columns is not fixed. There are several ways to achieve this.
x
component of all the labels’ custom_minimum_size
property which is in the “Layout” group in the inspector view, to the same value. Do the same for the inputs.GridContainer
in which you can set a column
property for the column count. This way, every cell in the same column will have the same width, and every cell in the same row will have the same height.Don’t worry about the second solution, for the biggest feature of Container
is it’ll adapt to its child nodes’ size.
Alternatively, you can do it oppositely. You first separate them into two columns, using an HBoxContainer
node. Inside the HBoxContainer
, place two VBoxContainer
nodes for two columns. Then, put all the labels into one VBoxContainer
, and the input nodes into the other.
You can easily set a fixed value or ratio for the width of the columns this way. For a fixed width, set the custom_minimum_size
as before. For ratio sizing, adjust the “Control/Layout/ContainerSizing/StretchRatio” property in the inspector view for each column.
Thx bro
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.