Playing around and created a trivial application that puts an instance of MusicPane in a Viewport and displays it. MusicPane inherits from Component and calls setSize(1000, 1000) in its constructor. This code works as expected:
MainComponent::MainComponent()
{
setSize (600, 400);
addAndMakeVisible(viewport);
addAndMakeVisible(musicPane);
musicPane.setSize(1000, 1000); // why is this necessary?
viewport.setViewedComponent(&musicPane, false);
viewport.setScrollOnDragEnabled(true);
viewport.setViewPosition(500, 500);
}
The MusicPane shows up and everything works fine. What puzzles me is that if I fail to call musicPane.setSize() in MainComponent(), the Viewport doesn’t show anything at all; I just see the MainComponent. How is calling musicPane.setSize() here different from calling setSize() in MusicPane’s constructor?
(Juce 5.3, if it matters.)