Making widgets below a child-window always visible

Hey all, little ImGUI layout question :)

Say I have a ChildWindow with a bunch of widgets inside, and just below that some buttons.


I would like the buttons to be always visible, no matter the size of the window. When shrinking the window, the buttons should “push” the ChildWindow to make it smaller :


I’m able to achieve that behavior by setting a negative Y size on the ChildWindow that corresponds to the height of the buttons. So if the buttons have a height of 0,20, setting the ChildWindow’s size to -0,20 works.

Is there a more automatic way to do that? Feels weird to have to retrieve the size of an widget and feed somewhere else to align things. I could not find any attribute that would help me.

Thanks in advance!

I was looking for something like that and played around for a while as well and in the end just had to do something similar, where you calculate the position of it based on the window size.

Here is what I did for a sort of fixed bottom bar, which displays a status:

So I think that might be the way to do it, at least I have also not found a better alternative yet.

1 Like

Nice, thanks for sharing @seltzdesign :)