Pointer to MainComponent


this is my first post here in the forum. I started checking out JUCE last week. So forgive me, if i am asking a newbie question.

I want to have a pointer to my main component in all sub components, so they can later communicate with it. Maybe this already “wrong thinking”? When i put a pointer (MainComponent *main) into a sub component, the compiler tells me, that it does not know “MainComponent”. But it’s definitly included.

If i do it with the base class “juce:Component” ist works fine.

What am i doing wrong?


i think every component has a method called getTopLevelComponent() or something anyway. maybe try if that works for you. if not, post some code so we can check if it does what you expect it to do together

Yes! Thanks that was really helpful indeed! After some thinking i realized, that everything i needed is already there :slight_smile: