Sub-Components of GUI Module


#1

Just getting familiar with Introjucer here, so bare with me if I'm missing something obvious...

  • I've created a GUI component "MainComponent" using IntroJucer's GUI editor.
  • On that MainComponent I've placed a TabbedComponent with 2 tabs.
  • I've created 2 other seperate GUI components, BasicTab and AdvancedTab, to hold the content of each tab.
  • In the GUI editor, I've configured the TabbedComponent so that it's two tabs both have:
    • content type = "Named content component"
    • content class...Tab1 = "BasicTab", Tab2 = "AdvancedTab"

This appears to generate the code I would expect...


MainComponent::MainComponent ()
{
    addAndMakeVisible (tabbedComponent = new TabbedComponent (TabbedButtonBar::TabsAtBottom));
    tabbedComponent->setTabBarDepth (30);
    tabbedComponent->addTab (TRANS("BASIC"), Colour (0xff2b2b2b), new BasicTab(), true);
    tabbedComponent->addTab (TRANS("ADVANCED"), Colour (0xff2b2b2b), new AdvancedTab(), true);
    tabbedComponent->setCurrentTabIndex (0);

    ...

...except that the MainComponent class has no idea what a BasicTab or and AdvancedTab is, so it fails to link-up.

To get this working, I manually edited the user-editable portion of MainComponent.h as follows:

//[Headers] You can add your own extra header files here...
#include "BasicTab.h"
#include "AdvancedTab.h"
//[/Headers]

My question is: Is this the correct way to to this? Or is there a smarter way to have IntroJucer include the necessary child components?