Proper way to create a child window on Mac?


#1

I want to create a window that’s a child window of my application, and which will remain on top of my application while it’s visible. My code looks something like this:

   testWindow = new TopLevelWindow("child", false);
   testWindow->setSize(1000, 500);
   testWindow->setOpaque(true);
   testWindow->addToDesktop(ComponentPeer::windowHasTitleBar  | ComponentPeer::windowHasCloseButton, interface->getPeer()->getNativeHandle());
   testWindow->setVisible(true);

I’ve tried setting different style flags, creating different window types (e.g. DocumentWindow), and passing in interface->getPeer()->getStyleFlags() for the style. In every case, the window I create has no title bar, and cannot be moved around - it’s just a pure black window. Furthermore, the window doesn’t act like a child window, as clicking on my main application will cause the application window to cover the new window.

Am I doing something wrong? What’s the correct method to create a simple child Window in Juce on the Mac? This seems to work fine on the Windows side.

Thanks!
Dan


#2

I figured out that I can call setUsingNativeTitleBar(true) to get the title bar to show up, which is an improvement. But the window still doesn’t act as a child window, always on top of the application. Clicking on the application window will cover up the new window, and the only way to find it is to minimize the application, which does not minimize the new window.

Thanks,
Dan


#3

maybe setAlwaysOnTop(true);