Hi
After searching the forum I see that this question has been raised before over the years, but with no definitive answer/solution.
http://www.juce.com/forum/topic/componentaddtodesktop-and-setalwaysontop
http://www.juce.com/forum/topic/child-window-behaviour-desktop-windows-possible
As I see it as a pretty important/basic function I would like to pick this up again.
So:
I have an application with multiple windows, the main window and some floating windows that could be editors, toolboxes, etc.
Like in this picture:
Same as most adobe apps, visual studio,etc
Now, if you simply create these windows, naturally, if you click on the main window the other windows will go behind the main window. You can set the child windows to setAlwaysOnTop() but then they stay on top of all other application windows.
The behavior you want is that the child window stays on top of the main window at all time, but that the child window and the main window can go behind other apps.
So the Z of the child would be the main apps Z+1 (sort of)
I have managed to achieve this by not setting the windows to AlwaysOnTop, but rather bringing them to front by overriding focusGained() and activeWindowStatusChanged() of the main window and looping the child windows. This works on windows but not on osx.
In addition on osx it creates an issue with the native menu bar; if you click on a editor window the menu gets disabled, and cant be used before you focus the main window.
I’m thinking that many of you have had to fix this in your apps? Like with plugin editors in hosts. It would be super annoying if an editor kept hiding behind a maximized app-window.
Any ideas surrounding this issue would be most welcome. If I find a solution I would be sure to post it back here.