but it doesnt work. it should display the tabComponent with 1 tab.
As you can see tabComponent is of type TabComponent (my class that inherits TabbedComponent) but when i change it to TabbedComponent it works. is there anything i should do if i want to inherit from TabbedComponent?
The documentation how this class is used is indeed not very verbose. You need to look either at the JuceDemo or at the sources.
You are overriding resized and paint, but there is indeed a lot happening:
The TabbedComponent is the container for other components to show up. You add any arbitrary Component using TabbedComponent::addTab()
See the Juce Demo here:
The resized() and paint() methods are kept, only the constructor is changed, which you don’t need to do, because all methods called here are public, so you can call them on an instance as well.
That’s really up to you. I think it makes sense just have the vector alongside the tabbed component.
I would only put that into a subclass, if I also want to change the behaviour of the tabbed component, e.g. if I want my custom drawing etc.
EDIT: I think you can even do without the vector, because the tabbedComponent stores them anyway. Only drawback is, that then they are Components that you have to dynamically cast to Viewport, if you want to call viewport specific methods. But the bonus is, you don’t have to worry about ownership, lifetimes etc.