How to expand/reduce parent component's size in relation to their child component

Hi All,
In the example MDIDemo - JUCE/MDIDemo.h at master · juce-framework/JUCE · GitHub,
How can I expand/reduce the size of parent component when I move a child out of parent’s bound?

Here the MDIDemo: 29.01.2022_22.27.00_REC

Here my expectation: 29.01.2022_22.16.22_REC

Thanks for your help

In my opinion, this is actually a very common use case. Imagine having an expand button (or nested expand buttons). The child knows when it needs more space but has no way (or I couldn‘t find one) to tell that his parent, and therefor trigger an recursion until one component says stop. I could think of either max window size or a Scroll-View that can expand its viewed component until infinity but stays at a fixed size no matter what the child wants.

I couldn‘t figure out a clean way. I ended up setting the parent from outside, so the child can call a notify method.

1 Like

Using a callback methodology, you can notify the parent that it needs to update when the child exceeds its bounds.

See std::function and lambdas.

1 Like