What should we be doing in our editor onSize method?

What should we be doing in this method? I thought this would work, but it doesn’t. It it does increase the size of the frame, but not the container for the frame. Do we need to call platform specific APIs to to do the resizing (for example SetWindowPos on Windows).?

Steinberg::tresult Editor::onSize(Steinberg::ViewRect* newSize) {
 
    frame->setSize(newSize->getWidth(), newSize->getHeight());
    return Steinberg::kResultTrue;
   
}

I figured it out–sort of. My solution is described below. The problem is that everything looks like crap as the UI is just sorta bitmap zoomed to fit. I don’t actually want to zoom in. I just want the frame to get larger. Any ideas?

  1. Override the setFrame() method to get the pointer to your editor’s IPlugFrame.
Steinberg::tresult PLUGIN_API setFrame(Steinberg::IPlugFrame* frame) override {
        plugFrame = frame;
        return Steinberg::kResultTrue;
    }
  1. In the onSize method, save a copy of the ViewRect and set a flag so that you know you need to call the resize method.
Steinberg::tresult Editor::onSize(Steinberg::ViewRect* newSize) {
    shouldResize = true;
    pendingSize = *newSize;
    return Steinberg::kResultTrue;
}
  1. In you editor’s notify method, call the the resize method.
VSTGUI::CMessageResult Editor::notify(VSTGUI::CBaseObject* sender, const char* message) {
    if (message == CVSTGUITimer::kMsgTimer)
    {

        if (shouldResize) {
            shouldResize = false;
            if (plugFrame) {
                plugFrame->resizeView(this, &pendingSize);
            }
        }

So disregard everything in the above post. The answer is incredibly simple and comes custosy of the VST 3.6 SDK which I found in a backup from 7 years ago.

Youll probably need to add an error check in there to make sure your editor has been fully opened otherwise Reaper will crash.

Steinberg::tresult Editor::onSize(Steinberg::ViewRect* newSize) {
return VSTGUIEditor::onSize(newSize);
}