Problem is more basic (was: Does getAreaCoveredBy(Component&) consider the menubar component?)


I’ve looked deeper and my divider bar implementation may be the root cause of all of this. I have to fix that and then revisit the embedded HWND. So please disregard the message below. Sorry.

I’m trying to embed a native Windows HWND inside my JUCE application. I’m roughly following the way OpenGL was implemented. I’m having trouble figuring out why my HWND positioning during parentComponent.resized() is placing the native HWND on top of the menu bar.

// earlier in the code execution juce::Component* pParentComponent = getParentComponent(); juce::Component* pTopComponent = pParentComponent->getTopLevelComponent(); juce::ComponentPeer* pTopPeer = pTopComponent->getPeer(); juce::ComponentPeer* pNativePeer = juce::createNonRepaintingEmbeddedWindowsPeer(*pDummyComponent, pTopPeer->getNativeHandle()); ... // the trouble auto rGlobal = pTopPeer->getAreaCoveredBy(*getParentComponent()); auto rLocal = pTopPeer->globalToLocal(rGlobal); pNativePeer->setBounds(rLocal, false);

It appears like ComponentPeer::getAreaCoveredBy() is not including the height of the menubar component when setting the origin in the returned rectangle. I also have a similar issue with the vertical divider bar but one problem at a time. The end result looks something like this (the exposed purple is where the HWND should be):