EditorComp sudden resize in VST RTAS AU

hi,

I have some temporary Components added using getTopLevelComponent() (tooltips for example) instead of adding them to the desktop.

It took me some time to discover that it was because of that that my plugin window was suddenly changing its size.

I’ve had to change that:

            void resized()
            {
                juce::Component* const c = getChildComponent (0);

                if (c != 0)
                    c->setBounds (0, 0, getWidth(), getHeight());

                repaint();
            }

to

            void resized()
            {
                if (editor != 0)
                    editor->setBounds (0, 0, getWidth(), getHeight());

                repaint();
            }

and store the pointer to editor in the constructor

it’s also necessary to check in childBoundsChanged() that the child is really our Editor and not a temp Component

Hi Jules,

I have run into the same issue: when I add BubbleComponents with getTopLevelComponent->addAndMakeVisible(…) , the VST wrapper component shrinks its window to match the bubble size. I had to patch the EditorCompWrapper::childBoundsChanged() function of juce_VstWrapper.cc so that it just returns when the child is not the first child

I would like to know if this can be considered as a bug, or if it just “bad practice” to add BubbleComponents (and other transient components) to the top level component ? (I prefer not to add them to the desktop)

Not sure if this is technically a bug - if you call getTopLevelComponent in a plugin, you’re going to get something that might not do what you expect, depending on how the wrapper code works. What I’d suggest is just adding the bubble to your editor component, and avoid using getTopLevelComponent in a plugin.