Child window behaviour for desktop windows possible?

Hello :slight_smile:

Iā€™d like to make some desktop windows behave like childs of another desktop window and canā€™t seem to find a solution.

for example:

i have 3 windows on the desktop
main, child1, child2

what i would like to achive is that if i click on the ā€˜mainā€™ window, it will also bring ā€˜child1+2ā€™ to the front of all other windows on the desktop and always keep ā€˜child1+2ā€™ in front of the main window.

when i minimize the ā€˜mainā€™ window, ā€˜child1+2ā€™ should also be minimized.

The z-order of the ā€˜childā€™ windows should stay the same unless i click on a ā€˜childā€™ directly.

so in the end i need the same behaviour as if i would add the 2 childs to the main window component, but keep them as windows on the desktop.

is this possible?
so far i could only find the alwaysOnTop() function, which is not what i need.
using toFront() and toBack() would involve a lot of gain/lostFocus() checking and seems a bit complicated.

any help welcome! :wink:
comboy

Iā€™ve been trying to do similar to this for handling plugin windows. I ā€œhackedā€ the TopLevelWindow timerCallback and setWindowActive so that activeWindowStatusChanged isnā€™t called until all windows have had their active state changed. This way activeWindowStatusChanged in your child windows can check to see if the main window is active or not. The child windows are set to be always on top and are changed to be otherwise when none of the apps windows are active. Or something like that. I was just about to ask this question and have also just begun testing this method so I canā€™t say itā€™s perfect, but it seems helpful to have windows states updated first. Jules would you be interested in making a proper change to allow this? Or maybe Iā€™m missing something and doing it wrong!

EDIT: this is the portion of timerCallback in TopLevelWindow, setWindowActive no longer calls activeWindowStatusChanged. Itā€™s just a hack to test it out.

            for (int i = windows.size(); --i >= 0;)
            {
                TopLevelWindow* const tlw = windows.getUnchecked (i);
                tlw->setWindowActive (isWindowActive (tlw));

                i = jmin (i, windows.size() - 1);
            }
			
            for (int i = windows.size(); --i >= 0;)
            {
                TopLevelWindow* const tlw = windows.getUnchecked (i);
                tlw->activeWindowStatusChanged();
                i = jmin (i, windows.size() - 1);
            }

hmmm, okay.
thanks for the tip, at least itā€™s better than my current experiment using the gain + lostFocus() functions :wink:

I hoped Iā€™m just overseeing something since with the windows API this behaviour is just a windows style flag to set.
not sure about osx and linux though and i like to stay cross platform.

comboy