(re)painting a particular component within a compound component?

I have an array of compound components (class derived from component that contains various components…) that each contain a slider.
When another part of the app updates the position of the slider, it calls a method of the compound component that does nothing more that call mySlider.setValue();
It turns out that the paint method of the whole compound component is called each time.
Is it possible to have it only redraw the slider and not the whole component?

There’s probably a way, but you’ll have to share a simple example to get some more help.

If your sliders aren’t marked opaque (juce::Component::setOpaque()) then the parent component will also repaint itself just in the area of the child’s bounds.

It should be the case that the parent isn’t repainting its entire area if a child repaints, but you can double check by enabling JUCE_ENABLE_REPAINT_DEBUGGING in your project’s AppConfig.h. This will highlight sections of the screen as they’re repainted, and it should just show flashing colors around the sliders when they change.

SetOpaque() seems to be what I’ve been wanting. The component does need to be opaque otherwise all kinds of artefacts are rendered (as you’d expect).
I’ve enabled the JUCE_ENABLE_REPAINT_DEBUGGING but have not observed the flashing (I haven’t been drawing child over parent as yet just sibling over sibling but I will explore this more.