I am confused about something.
Child components (or “subcomponents”) are by default private members of the parent component class when building in the JUCER. So far, so good. I understand the need for encapsulation here. Especially when each component can be defined in a separate .h and .cpp file.
Let’s say I have some model parameter, call it param123, connected to a slider inside a component called myComponent. I would pass the component a pointer to my model so that when the user changes the slider, we can modify the value in the model. Or the component has a pointer to some other thing that controls the model; whatever. That works fine.
If my param123 change originates somewhere else, how do I update the slider? Since the subcomponents are private, I will have to say myComponent->setParam123(value). And write this method to change the slider value. If I want to place myComponent in a tab component, I have to write another proxy method to shuttle the event down. (In this case, the layer of private encapsulation is superficial and unnecessary, I only meant to clear some space on the window!)
Then we have MainController.onParam123Changed() => tabbedComponent.setParam123() => myComponent.setParam123() => param123Slider.setValue(). Is this horror an artifact of the Jucer or something I shall learn to live with?
Surely I am missing something, surely there is a better way. In Qt I have used SIGNALS and SLOTS to build some coupling of this sort at runtime. But in Juce I’m in a little new territory.