Embedding component with native window peer

Hi all,

I’m trying to embed a component inside a hierarchy of other component and have it contain its own native window peer, so that I can pass it to third parties to draw on (e.g. like audio plugins). I’ve been searching the forums/internet, and several solutions seem to come up, but none of them do exactly what I need.

The closest I’ve come is creating a Component and calling addToDesktop(0) and setVisible(true) on it. Then I’d need to move the loose window over my component using screen coordinates every time the containing window moves/resizes. This seems cumbersome and I suspect it’s not the way to go.

How does ROLI/JUCE actually recommend that I do this?

Yes I think that’s one way you could do this. At ROLI we use this approach for NOISE. As NOISE is a mobile app, we don’t need to track any window movements as the top-level window will not move anyway (it’s fullscreen). If the user rotates the device, we simply dismiss all of the native windows (they are only used for temporary windows anyway).

Another way would be to create the native view yourself with native code and then use the native embedding classes provided in juce_gui_extra/embedding. This will handle all the window tracking etc. for you.

Alright, thanks for you reply! I guess I’ll just start tracking window movements and see how far I can get.