[SOLVED]Resize Plugin Editor from an child Component

Hi every one.

I have an issue with resizing my plugin editor from an other component.

In fact i have an mainComponent which is a child of my plugin editor and got a comboBox that should change the window size when one of the options is selected.

my plugin editor inherits from an ComboBox::Listener and subscribes to the combobox in the mainComponent thanks to the following public method

MainComponent::SubscribeComboBox(ComboBox::Listener* listener){

and there is the comboBoxChanged method overrides by my plugin editor

void comboBoxChanged(ComboBox *comboBoxThatHasChanged) {
    if(comboBoxThatHasChanged->getSelectedId() == 0) {
        setSize(800, 600);
    else if(comboBoxThatHasChanged->getSelectedId()== 1) {
        setSize(800, 700);

the problem is that when i’m debugging the code in visual studio every thing works fine but when i’m in the AudioPluginHost with the VST3 Build it doesn’t work.

Did anyone else had this problem? and if they did what should i do to avoid this issue?

PS: i know that putting the comboBox inside the plugin editor instead of the mainComponent solve the issue but i don’t want to put it there because i need it in the mainComponent for audio processing ( the main component got all the buttons and attach them to a value tree state passed from the plugin editor).


getTopLevelComponent() and call setSize() on the returned component maybe?

1 Like

It’s fixed thank you very much!

I made my mainComponent subscribed to the comboBox and resize the topLevelComponent but i still need the plugin editor to be subscribed ( because with just the topLevelComponent->setSize() function nothing was happening).

I put my code here:
auto topLevel = getTopLevelComponent();
if (topLevel)
if(comboBoxThatHasChanged->getSelectedId() == 0) {
topLevel ->setSize(800, 670);
else if(comboBoxThatHasChanged->getSelectedId()== 1) {
topLevel ->setSize(800, 770);

Note : the size of the topLevelComponent need to be bigger than the plugin editor because it considers all the window including the title bar.