How to size container to fit contents when contents added through code

ericwood73ericwood73 Posts: 5Member

I'm building a UI using the container based workflow, as it makes more sense to me and seems to do the right thing when the window is resized. I want to add a control panel to the bottom right corner of the display. This panel is an instance of my ThrusterControlPanel that has a grid container. I populate the grid container in code based on the number of thruster nodes. I'm using an HBox with a empty control node to right align a vbox with an empty control node to bottom align the control panel. The empty control node is set to expand vertically to force the control panel to the bottom. The control panel is set to fill only. My expectations are that the control panel would get as much space as it needs to contain the grid with all of it's controls and the empty node would get the rest. What is happing is that the control panel is pushed past the bottom of the screen. This happens even if I add some static content. If I set the panel to expand, than it gets half the vertical space, which is what I would expect, but not what I want. If I set a min y size, then the panel gets that, but what I want is that the panel mix size is based on the contents. This seems to work for other containers, but not for the way I have it setup. Do I need to force min size in code, or is there something I am doing wrong? Is it maybe because the function that adds content is in the ThrusterControlPanel scene which is instanced in?Screenshot

Sign In or Register to comment.