Switching between different layouts

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
pongasoft
Posts: 50
Joined: Sun Mar 11, 2018 5:57 pm

Switching between different layouts

Postby pongasoft » Tue Jul 17, 2018 3:03 pm

If you look at this code fron the AGain example:

Code: Select all

IPlugView* PLUGIN_API AGainController::createView (const char* name)
{
   // someone wants my editor
   if (name && strcmp (name, "editor") == 0)
   {
      auto* view = new VST3Editor (this, "view", "again.uidesc");
      return view;
   }
   return nullptr;
}


it is not hard to imagine having multiple uidesc for different kinds of layout. For example I could imagine having a "compact" view where the size of the entire window is much smaller than the "normal" one.

The code could then easily do

Code: Select all

IPlugView* PLUGIN_API AGainController::createView (const char* name)
{
   if (name && strcmp (name, "editor") == 0)
   {
      auto xmlFile = getParamNormalized(MyParamIDS::kLayout) == 1 ?
         "again.uidesc" :
         "again_compact.uidesc";
      auto* view = new VST3Editor (this, "view", xmlFile);
      return view;
   }
   return nullptr;
}


The part I am struggling with is how do I add a toggle button in the UI tied to the MyParamIDS::kLayout parameter that would essentially force the UI to close and reopen with the new layout.

Any idea on how to do this?

Thanks
Yan

Arne Scheffler
Posts: 212
Joined: Mon Jun 20, 2016 7:53 am

Re: Switching between different layouts

Postby Arne Scheffler » Mon Jul 23, 2018 10:33 am

Hi,
see VST3Editor::exchangeView (). This is the preferred way to do it. Just create another template in your uidesc file and switch between them with the exchangeView call.

Cheers,
Arne

pongasoft
Posts: 50
Joined: Sun Mar 11, 2018 5:57 pm

Re: Switching between different layouts

Postby pongasoft » Tue Dec 04, 2018 6:01 pm

I am having an issue making this work. I defined another template as you described (for testing purposes, I defined an empty template with red background color AND different size).

Although it does switch (meaning I see the new template), the window does not get resized with the new size (I have tried with the editor and the VST3PluginTestHost app).

Any idea how to make it work?

Thanks
Yan


Return to “VSTGUI”

Who is online

Users browsing this forum: No registered users and 1 guest