Child window advice required


I am new to JUCE and am considering using it for a commercial application ported across at least Windows, Mac and Linux. My background is 22 years C++ on Windows and a small amount of non-graphical real-time Linux programmming. I need to know how to do something very simple, but which is not so obvious to me from the JUCE documentation. Basically the visual framework of my application consists of a main window with 3 or 4 child windows arranged on it. It’s all standard stuff – when the main window is moved the child windows move with it, I will handle the ReSize event for the main window to resize the children, and so on. I just need to know what is the class I should use to obtain a child window with a fixed sized border. Do I use a TopLevelWindow and make it a child of the main window? How do I specify a fixed sized, non-resizing border? I’m assuming this is as easy to do as it would be in the MFC on Windows; it’s just not so obvious to a newbie,

With thanks, in anticipation of help,

Sahlan Diver


Sounds like you just want to use a DocumentWindow - they can either work as desktop windows, or just add them to any other component as a child comp.


Thanks for the hint. I’ve used ResizeableWindow rather than DocumentWindow, as I don’t want a title bar.

Also, because I don’t want my child windows to be draggable I’ve set a derived ComponentBoundsConstrainer which has checkBounds() overridden to do “bounds = previousBounds”. It successfully prevents window drag in the Microsoft Windows build I am initially testing with, and I hope that is an approved technique.

As a newcomer I have a question re JUCE programming philosophy as regards “Content Components”:

Following the example of the JUCE demo, I create a “ContentComponent” for the MainAppWindow, and I call addAndMakeVisible() to add my child window to the ContentComponent, rather than adding it directly to the MainAppWindow. My question is should this strategy be repeated for the child window if I want it to be the parent of a child window nested inside itself? Should I always, in a hierarechy of nested windows, create a ContentComponent for each window to which I wish to add one or more child windows?


Not really 100% sure what you mean by “window”… You can put any component inside any other component, so it’s up to you how you structure things. The idea of having a “content component” is only relevant in classes like the ResizableWindow because it needs to create a frame to surround your component.