Child extend beyond bounds of parent?


#1

Can a child component extend beyond the bounds of its parent? For example if a component is 100x100px, can one of its children be 200x200px and entirely visible, or will it always be clipped to the size of its parent?

This sounds like a really basic thing to know, but I couldn’t find anything relevant in the docs or forum. Thanks!


#2

In general the painting it is cropped.
You can disable that using Component::setPaintingIsUnclipped(), but the update mechanism will not catch the artefacts you created outside, so it is a bad idea.


#3

Good to know. So I assume that typically people don’t nest components with large dimensions inside components with smaller dimensions?

For context, I have a small component containing a button that will reveal a second component that fills the plugin stage (basically a modal for displaying plugin options). It sounds like that modal component can’t be a child of its smaller parent, in which case I will just move it higher up the component hierarchy.


#4

You mean like a CallOutBox?

https://docs.juce.com/master/classCallOutBox.html


#5

CallOutBox could theoretically work. My component is designed to fill the plugin stage completely (modal was possibly an inaccurate term to use), but it sounds as if CallOutBox could be twisted to that purpose by positioning it at 0,0 and giving making it the width and height of the plugin.

I have gone ahead and moved my component higher up the component tree so that it sits within a full width & height parent, but it is good to know about CallOutBox for the future.