Hi,

I get that containers are for alignment and my project is behaving as I expect it to in terms of layout.

What I want to do is place these score containers in a rounded rectangle background.

I've tried all sorts of combinations with a Panel, but invariably the layout gets messed up.

Is a better way to add a background to these score containers to use a texturerect?

In the image below I've used the convention VContainer and HContainer to annotate the underlying type - VBoxContainer and HBoxContainer

What I'd like is for a background to be applied to the area that the VContainer takes up.

The problem seems to be that if I add three panels as children of a hboxcontainer their placement does not get managed by the container. They do, if you give them a manually calculated minimum x size, they won't derive this from their contents (they don't expand to cover what they contain)

So the answer to my question is:

  1. Place the container inside something that can have its background set (like a Panel, for example)
  2. Manually set the size of the Panel
  3. Make sure the container is positioned inside the panel

Step 2 feels funny because I thought the point of containers was to allow flexible layouts, but after experimenting with the scaling options in the Project settings it feels like all the heavy lifting is done by the engine and having some hard-coded placement data isn't awful.

Welcome to the forums @shatahn!

You probably need to set the min_size property, as the container nodes will attempt to position and size all elements based on the minimum sizes of each Control node :smile:

2 years later