About one second after the plugin is opened, if the splash screen is shown, the title text disappears like the left image. It reverts back to normal after the plugin is closed and opened again. If the splash screen isn’t shown, the plugin looks like normal, the right picture. The same code also worked in JUCE4.
The title is drawn inside AudioProcessorEditor::Paint() with
g.drawFittedText(“PAN KNOB”, getLocalBounds().removeFromTop(topMargin), Justification::centredTop, 1);
The other text is drawn by adding labels, and they seem to be unaffected.
You’re telling it to draw the text in a rectangle with height 1. The only reason you can see it at all is because it’s spilling over those bounds, but the context won’t bother to attempt to draw anything unless that rectangle overlaps the dirty region.
Oh, thanks! I got it to work as expected now.
I think I am not entirely clear on the getLocalBounds function though.
Shouldn’t getLocalBounds() as written in the paint function return a rectangle the size of the editor, as set in the audioprocessoreditor constructor? Which in this case is 250x200 pixels, and removeFromTop would only remove a tiny slice of that (topMargin is <10).
You are correct about the getLocalBounds(). However, removeFromTop returns the removed bit of the rectangle and changes the object it is called on, so you can re-use it to layout the rest of your stuff.
That means, that calling it on getLocalBounds() makes no sense, as it is removed afterwards anyway.
What you were after is probably more like:
auto bounds = getLocalBounds().reduced (margin);
g.drawFittedText("PAN KNOB", bounds.removeFromTop (lineHeight), Justification::centredTop, 1);
// bounds is now reduced by lineHeight from the top.
Yeah, that makes a lot of sense. That was what I was missing.