How to clear a section of a window


#1

On OSX I need to programmatically clear a section of my JUCE window in order to simulate it being below a window on a lower level. Because of other layering considerations it's impossible to actually lower my window's level or send it to the back, so I'm trying this (admittedly) hacky solution to fake the desired effect. 

Is there a way in JUCE to completely clear a section of my component after the paint callback. Basically I want to cut a hole in it, including all child components so that everything is transparent in the desired Rectangle. It would be similar to paintOverChildren but instead of painting on top of, I'd be clearing everything out in a certain section.

Thanks!


#2

That's not how windows (or components) work!

You can create a non-opaque window, and leave an area of it unpainted, which achieves the same effect, but it's not a case of "clearing" anything.

There could be problems with hit-testing though, because mouse-events over a transparent area of a window may or may not be sent to windows behind it, depending on the OS. I'd recommend not going for a "hacky" approach like this, but to think more clearly about what you're really trying to do!