AddAndMakeVisible does not match documentation


I’m sorry to complain about such a detail, but I noticed that the Component::addAndMakeVisible() method doesn’t do what is described in the documentation.

Doc says : [quote]this is just the same as calling addChildComponent() followed by setVisible (true) on the child. [/quote]
but code does it in the reverse order.
This is annoying when, for example, visibiltyChanged() relies on the parent…

Is there a reason why it was done this way ? If not, you may wanna modify it :

// \src\gui\components\juce_Component.cpp lines 1139 to 1146

void Component::addAndMakeVisible (Component* const child, int zOrder)
if (child != 0)
child->setVisible (true);
addChildComponent (child, zOrder);

Thanks for all the job you do !



Thanks for calling me out on that one! What probably happened is that I’d have written the comment a long time ago, then probably changed the actual method later without realising the docs needed updating. I’ll make sure it’s all consistent!