How do I align my GridContainer - or rather its child elements - on the right?

Godot Version

Godot 4.3.stable

Question

Hi, I have a grid at the right side of my screen and i want new rows to be filled from the right side, not the left.

How do I align my GridContainer - or rather its child elements - on the right properly?

I can set the Layout Direction to Right-to-Left but it also mirrors my labels within the child elements and I don’t think that’s the intended way.

GridContainer can only fill left to right. Sorry.

Your only other option is to not use grid container and just use plain control nodes to replicate it but then your rows can be set to shrink_end so the row elements behave the way you wanted. But you do lose the convenience of a grid container. And it takes a lot more ‘fiddling’ in code to limit elements in the rows and create a new row when one fills up etc.

I have in the past added blank elements. So you have four columns. If you know how many elements there are left to add (assuming you are instantiating them in code) and they are less than four, you can add blank elements at the start of the row. Again this is something you would have to do in code and is a bit of a pain TBH.

Sorry if that was not the news you were hoping to hear!

1 Like

As @pauldrewett said, You just can do this with the placeholder nodes
Unless you make the grid node right-to-left and the children left-to-right.

1 Like

Well, that’s a shame. I’ll probably use a VBoxContainer with some HBoxContainers to build the grid myself then.. Thanks for your answers.

1 Like

I created a new custom node for this topic and it is now available in Elementum.

1 Like

@Mahan Wow! That was quick! Very impressive. I really must have a deeper look at Elementum. Thanks!

1 Like