How to create TabbedComponent?

gui

#1

Hello, i am trying to understand how to work with TabbedComponent and i stuck in the beginning.
So, i am trying to create a TabbedComponent like this:

TabbedComponent tabComponent(TabbedButtonBar::Orientation::TabsAtTop);

And it is wrong. I saw in documentation and there is this line:

TabbedComponent (TabbedButtonBar::Orientation orientation)

I don’t understand, what am i doing wrong.

Also, i saw some information about it in forum and i found that i can create it like this:

TabbedComponent *tabComponent;
addAndMakeVisible(tabComponent = new TabbedComponent(TabbedButtonBar::TabsAtLeft));

But, can i create a TabbedComponent without pointer? And i dont feel the differense between creating a TabbedComponent with pointer and without, like i tried. So, can anyone explain to me, how to create it and what did i do wrong?
Thank you!


#2

In your .cpp file:
MyTabbedComponent::MyTabbedComponent() :myTabs(TabbedButtonBar::Orientation::TabsAtLeft)

myTab is then declared in the class header as
TabbedComponent myTabs;


#3

Google “C++ member initialization lists” for explanation !


#4

@tomto66 Thank you! But it is a bit wierd…


#5

What is weird please?