Possible bug: TabbedComponent and lookAndFeelChanged()


#1

Hi,

I think there is a small bug in case a slider is placed in a TabbedComponent. Slider textboxes are created on the fly everytime a lookAndFeelChange event is send. However, as invisible tabs do not have a parent component, calling getLookAndFeel() in the slider lookAndFeelChange() method will not return the current lookAndFeel object. From my understanding this can be fixed when TabbedComponent::changeCallback() resends the lookAndFeelChange event when the tab is switched visible:

 void TabbedComponent::changeCallback (const int newCurrentTabIndex, const String& newTabName)

    [...]

    if (panelComponent != nullptr)
    {
        // do these ops as two stages instead of addAndMakeVisible() so that the
        // component has always got a parent when it gets the visibilityChanged() callback
        addChildComponent (panelComponent);
		panelComponent->sendLookAndFeelChange();
        panelComponent->setVisible (true);
        panelComponent->toFront (true);
    }

What do you think?

Sebastian


#2

Yep this seems reasonable, I’ve added it to develop.

Thanks!