Tabs not showing in TabbedComponent's subclass

My subclass of TabbedComponent doesn't display any tabs

Possibly, I am missing something obvious, but I run

out of ideas about how to get my subclass of TabbedComponent to display any tabs.  

Please advise..

Here are the relevant fragments of my code:

- in myTabbedComponent.h file:


class myTabbedComponent  : public TabbedComponent
{
public:
    //==============================================================================
    myTabbedComponent ();
    ~myTabbedComponent();

...

- in  myTabbedComponent.cpp file:


myTabbedComponent::myTabbedComponent ()
    : TabbedComponent (TabbedButtonBar::TabsAtTop)
{
    //[Constructor_pre] You can add your own custom stuff here..
    addTab ("t1", Colours::lightgreen, 0,   false);
    addTab ("t2", Colours::lightgreen, 0,   false);
    addTab ("t3", Colours::lightgreen, 0,   false);
    //[/Constructor_pre]



    //[Constructor] You can add your own custom stuff here..
    //[/Constructor]
}

addTab ("t1", Colours::lightgreen, 0,   false);

...maybe try to give it a component instead of a null pointer (and please use nullptr instead of 0, if you need it).

e.g.

addTab ("t1", Colours::lightgreen, new Component(),   true);

Good luck

Thanks for your attempt to help.

I've tried all of the combinations like i.e. new Component(), a component that is a  static member of the class, ScopedPointer<TabbedButton> , nullptr, 0, ...etc.... . None of these work, but even if it worked, it shouldn't be considered a solution,  but rather, a temporary hack.  If "giving it a component" (as you kindly advised) instead of nullptr or 0  changed the situation, it still would be a problem of robustness of the TabbedComponent class. 

I fail to see why giving nullptr or 0 should result in tab not being displayed... tab is just a tab... whether it contains any nested components or not. 

Finally, if you use Introjucer to nest a TabbedComponent in another component, the addTab() calls use  0-es (not even nullptrs) as arguments and it works fine...

 

A class like TabbedComponent does a whole bunch of essential stuff in many methods like resized() etc. If you override them, then of course the base class won't work properly!

You really shouldn't be inheriting from TabbedComponent unless you're an expert. There's generally no reason to do so, you can just create one and use it.

Thanx Jules; that was a good hint.. :-) It works as expected...