[Article] "How Juce Components Work"

I wanted to cook up a few more diagrams to help break up the wall-o-text, but… I’ve moved on from spelunking for now!

I’m sure there are inaccuracies and some things left unclear, feel free to pipe up!

10 Likes

Great read, well done!

One addition to “what are the basics”

Components have to be explicitly made visible (via addAndMakeVisible in the constructor or via setVisible() at some later point) before they will be painted.

I think it is easier to understand if you write:

In order to become visible, Components need to be added to something, either to a parent component or to the desktop. Adding to the desktop often happens without you doing soimething, e.g. when the MainWindow or an AudioProcessorEditor is created. To add to a parent you need to call

addChildComponent (foo);
foo.setVisible (true);

or simply in one call

addAndMakeVisible (foo);
2 Likes

Thanks @daniel!

I tried to make that bullet point easier to understand with your advice.

I might remove the bullets and flesh out that basics section more properly a bit later. I was treating it as a list of pre-reqs for the rest of the article to be understandable. But probably no harm in a better review of the basics, as well…

Another takeaway I had from your feedback is that I’m steering clear of any real discussion of top level components, so I might flesh that out as well.