onClose event?

gui

#1

Is there an onClose event in JUCE?

I’m working with a library that runs in the background, if it is not closed properly it will not start the next time around. So, when i click on the ‘close’ button i want to inject a little bit of code that gets rid of any external processes properly.

I hope i’m being clear enough, but if you need more info feel free to ask.


#2

You can override DocumentWindow::closeButtonPressed() if you are using a DocumentWindow or if your window is just a Component added to the desktop then there’s the Component::closeButtonPressed() method.


#3

I’m making a VST plugin, so I inherit AudioProcessorEditor instead of Component. I see that AudioProcessorEditor inherits from Component, but I can’t override closeButtonPressed.

Thanks for the tip btw!


#4

What in the normal plugin code doesn’t work for you? Aren’t your AudioProcessor and AudioProcessorEditor destructors called when the plugin closes? If that is so, then the host using the plugin is probably at fault. (Which host is that?)


#5

Ah, thanks! I’m pretty new to C++, so i totaly forgot about the destructors… will give it a try :slight_smile: