How to call a component from a component inside tabbedComponent?


I have one situation that i cannot handle.

I have a tabbedComponent inside a mainComponent created this way:

addAndMakeVisible(tabbedComponent = new TabbedComponent(TabbedButtonBar::TabsAtTop));
tabbedComponent->addTab(zonesArray[0].description, Colours::transparentBlack, new contentTab(), true);

and my contentTab is a normal component.

From my content tab i have a button that needs to call a component that shoud be a child of my mainComponent.

I cannot open my child component directly from my contentTab, because, of course, my child component will open inside the tabbedComponent.

So how can I open a child component from mainComponent clicking on a button on my contentTab ?


How about something like this...

On the child component you want to open, make sure you set the id with setComponentId(childId). childId is a String which ought to be unique within that parent component's immediate children.

Then you can find the reference of the child component with: getParentComponent()->getParentComponent()->findChildWithId(childId)

Hi Andrew,

thank you for your reply, perhaps I've not explained well.

I have a mainComponent that adds a tabbedComponet.

This tabbedComponent show a contentComponent.

This contentComponent have a button that when clicked must open a child Component.

But if i open the child from the contentComponent, it will open the child Component inside my contentComponent.

I want to open it in the mainComponent.

How ?


getParentComponent()->getParentComponent()->addAndMakeVisible(childComponent) ?