Get standalone instance

Hi, is there any way to get the standalone instance (application?) from within the audio processor?

thanks

Haven’t tried, but maybe you could call

dynamic_cast<StandAloneFilterWindow*> (getTopLevelComponent());

I am still looking, if something similar is possible with JUCEApplication::getInstance()

EDIT: there is JUCEApplicationBase::isStandaloneApp() and then you can continue working with JUCEApplication::getInstance();

ah, thanks - i think the JUCEApplication::getInstance() was the call I was missing… cheers!

Hi. Whilst this gets me to the application, doesn’t give me what I want. I was hoping I could get the mainwindow to be able to call setUsingNativeTitleBar() but there doesn’t seem to be any public access to this. I must be missing a link of how to manipulate the top level elements in this way…?

thanks

I see, then you need indeed to go for the topLevelComponent.
Does this in your editor constructor work?

if (StandAloneFilterWindow* win = dynamic_cast<StandAloneFilterWindow*> (getTopLevelComponent()))
    win->setUsingNativeTitleBar (true):

Or instead of StandAloneFilterWindow you can cast to TopLevelWindow, hits in more cases… (but might also have effects in hosted situations).

Thanks for the tips. All the standard hooks in a standalone appear to get called as part of the createWindow() call in initialise() - not sure of anywhere to hook this afterwards to get the TopLevelWindow to make the call…

Going to try hacking a timer into the editor when it’s created to see if that at least does the goods…

posted a message from createEditor() to run the code you suggested and all works fine. I have a feeling there’s a cleaner way of doing this, but it’s good for now… thx for the help

I believe you’re meant to derive your own StandaloneApp class with the changes and then replace the default:

Cheers,

Rail

thanks for the pointer - this stuff could really do with some additional examples/documentation on how to go about customising these things I think…

2 Likes

For future reference, keep in mind that instead of the code above, you may find the following more beneficial for finding the StandAloneFilterWindow that you are searching for (from inside your editor Component):

StandAloneFilterWindow* w = findParentComponentOfClass <StandAloneFilterWindow> ();

Documentation of the findParentComponentOfClass() method is given here:

https://www.juce.com/doc/classComponent#ab96fafa69cc190b2ebc3a2daba3dbaeb

1 Like

thanks for the additional info!