# Possible bug: TabbedComponent and lookAndFeelChanged()

**URL:** <https://forum.juce.com/t/possible-bug-tabbedcomponent-and-lookandfeelchanged/21481>\
**Category:** General JUCE discussion\
**Created:** [March 23, 2017, 9:06pm UTC](https://forum.juce.com/t/possible-bug-tabbedcomponent-and-lookandfeelchanged/21481 "2017-03-23T21:06:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sebk/32/6425_2.png) [@sebk](https://forum.juce.com/u/sebk)\
**Post date:** [March 23, 2017, 9:06pm UTC](https://forum.juce.com/t/possible-bug-tabbedcomponent-and-lookandfeelchanged/21481/1 "2017-03-23T21:06:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [March 24, 2017, 8:56am UTC](https://forum.juce.com/t/possible-bug-tabbedcomponent-and-lookandfeelchanged/21481/2 "2017-03-24T08:56:49Z")

</div>

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

Thanks!
