Bug Report: getChildComponent(i) fails for 1st tab of TabbedButtonBar

Hi, I’m using the 5.2.0 .zip file from github.
You can see this bug in the JUCE Demo by adding the following lines in the DemoTabbedComponent() constructor, after the calls to addTab():
Component* childComponent = NULL;
String childName;
int break_here = 0;
for (int i = 0; i < getNumTabs(); ++i) {
childComponent = getTabbedButtonBar().getChildComponent(i);
childName = childComponent->getName();
break_here = 1;
This gets names for “Buttons” thru “Drag & Drop”, then a “” name, but never for the 1st tab, “Menus”.

It’s not a bug, you’re just not using the interface to that class correctly.

Your code assumes a 1:1 correspondence between tabs and child components, but that’s not how it works. You’d need to call getTabContentComponent, not getChildComponent.

Also a couple of pro tips: Indent code by 4 spaces to make it show up nicely on the forum. And never use that horrible old NULL macro! :slight_smile:

thanks Jules