I have 2 items as children in a layout. Is it possible to automaticaly align them in the center so they will always be positioned like that (relative). Right now I can only specify it in pixels which is problematic if the screen resolution changes.
I attached the image of how I want the items to be alligned automaticaly. Right now I would have to specify the padding and spacing in pixels. I would want it to be able to compute that automaticaly.
Is that possible yet or must I program it in C++ myself?
I would also like to know if itâs possible to automatically expand layout sizes: for example if I have 3 layouts inside a parent layout: is it possible to set a âweightâ (eg percent size) of each child so that they will fill the parent (so for example one layout takes 25% of the space, one takes 50% and the third takes 25% of space? Ascii: [ABBC], where A,B,C are the 3 layouts, where B has twice the width of A and C.
Try setting empty layoutâs paramareters:
Type = HORIZONTAL
Resize Mode = CHILDREN
then add 2 empty nodes to this empty layout - âleftâ and ârightâ
then add your purple square nodes as children - one into âleftâ node and one into ârightâ
Did you find a solution to this? I was going to post the same question but I found this topic. I know itâs old but Iâd like to revive it to see what the solution is.
Basically I want the same thing, automatic layout where I can set the size of a layout (ex: full height of a screen using widget component) and the layout can automatically spread the node children in it to span the height of the screen. I think this would allow to easily display a menu such as a list of buttons across the page.
But instead of setting the child nodes 25% from the top, 50% from the top (or centre), 75% from the top, I thought it would be nice if the layout parent node did that automatically and it could space out any number of nodes evenly. If we can do that then what would be a case where you would use the Layout component?
I seem to have gotten it to work. It works fine when I use resize mode: container with spacing.
I was thinking that the layout component would add automatic spacing based the layout size and child nodeâs sizes if using resize mode: children and the layout size was bigger than the combined sizes of the children nodes then the automatic layout would spread the child nodes evenly within its size.
The way you suggested works just as fine. Thanks for all your help!