1 Parent window, many childreen

Hi,

This is what I want to have :

  • The main window (parent)
  • Many child windows above the main window.
  • Only the main window appears in the title bar.
  • Child windows are not MDI (not inside the main window)

Any suggestion?

Me.

you should look at:
http://www.rawmaterialsoftware.com/juce/api/classComponentPeer.html
and set the right flags for those child windows.

Hi,

Thank you for the answer. In fact what I want to do is the same I did in VS (win32) or Borland C++…

Create a ParentWindow (parent = desktop) and create several windows for which the parent is ParentWindow. The normal behavioue is :

  • all child windows stays above the parent
  • Only one button is created in the taskbar for the ParentWindow.

A simple solution to do that with Juce?

Is ComponentPeek the solution?

Thanks,
Me.

Yes, you can do that kind of thing - just pass the right flags to the Component::addToDesktop() call.

Hi,

I tried the Component::addToDesktop() call.

myWindow = new GenericWindow(new GenericComponent(),"Test");
myWindow->addToDesktop(ComponentPeer::windowHasTitleBar+ComponentPeer::windowHasMinimiseButton+ComponentPeer::windowHasMaximiseButton+ComponentPeer::windowHasDropShadow+ComponentPeer::windowHasCloseButton);

GenericWindow is a DocumentWindow.

By doing that I have this error : “Juce thrown a breakpoint” in the following code:

static bool setSocketBlockingState (const int handle, const bool shouldBlock) throw()
{
#if JUCE_WIN32
    u_long nonBlocking = shouldBlock ? 0 : 1;

--->    if (ioctlsocket (handle, FIONBIO, &nonBlocking) != 0)
        return false;
#else

Did I make something wrong?

Thanks,
Me.

Well if you use a DocumentWindow you’ll need to fiddle with its look and feel to change the desktop flags that it uses. If you just use a normal component you can set it all more easily.

No idea why you ended up at that line of code though - looks like the linker messed up the debug info.

Hi,

Thanks for the answers. I’ll try all that.

Me.

Hi,

This is an example of what I want to have.

Is it a way to do it as easy as I did it with VS?

http://dl.free.fr/jb9sIhjGF/test.exe

Thanks,
Me.

Hi,

  • Child above mother
  • One button [mother] in the task bar
  • Minimizing mother, hide childreen

Any Idea?

Thanks,
Me.

These aren’t “children” - they’re not actually inside the main window, they’re just siblings of it.

You could either just use setAlwaysOnTop() to true for them, or move them toFront() whenever the mainwindow is itself brought to the front. And to minimise them, just catch the main window’s minimise event, and call setMinimised() on them all.

Jules, I’ve tried what you suggest here, but it doesn’t seem to work quite right. I have two windows and I want the smaller one to always be on top of the larger one. I tried implementing something like the following in my main app window class (subclass of DocumentWindow):

void focusGained(FocusChangeType cause)
{
  sibling->setAlwaysOnTop(true);
}
void focusLost(FocusChangeType cause)
{
  sibling->setAlwaysOnTop(false);
}

This mostly works, but the problem is that the sibling gets put on top of ALL the windows on my desktop (including the Windows taskbar) instead of just the main app window.
So I guess what I’m asking, would it be possible to implement a function like:

setAlwaysOnTopOf(Component *c, bool shouldBeOnTop);

or something? Just to specify a z-order for the app, but not the entire desktop?

I should also say that:

void broughtToFront()
{
  t->toFront(false);
}

does not work when you click on the title bar instead of inside the content component (at least on Windows).[/code]

sorry I meant sibling->toFront there

Yes, the problem is that there are many subtly different ways that windows can get shuffled around and making sure they’re all handled correctly is a PITA. One of my top to-do-list items is to add some proper functions for creating window “groups” that maintain their relative z-order, and that’d certainly do what you need.

Jules, has there been any functionality added for this “relative z-order” concept?

No, sorry, nothing new there.