This is possible by using the “virtual class” field in the Introjucer. It is somewhat tedious and the introjucer won't give you the correct preview - but it works. Here is a quick step-by-step tutorial on how to do this starting with a new project:
1. Create a new “GUI Application” Introjucer project and immediately delete the MainComponent.cpp/MainComponent.h from the project. Right-click on the “Source” group and select “Add new GUI Component…” from the pop-up menu. Name your file “MainComponent” and - under the Class tab - rename the class to
MainContentComponent. This will be your parent view and your application should now compile and just launch with an empty Window.
2. Now add a “New Group Box” child component to the MainContentComponent and change the “virtual class” field to “
3. Now create a new GUI component MyGroupBox.cpp/MyGroupBox.h with “Add new GUI Component…”. In the Class tab of this component, make sure that “parent class” field is
public GroupComponent, the “Constructor params” field is
const String& name, const String & text and the “Member initializers” field is
GroupComponent (name, text) You can add your subcomponents in the “Subcomponents” tab.
4. Change the background colour in “graphics” tab to be completely transparent. This will remove the fill operation in the paint method.
5. In the code tab, in the UserPrePaint section of the paint method add:
6. Compile and run your application
I hope this helps!