I have a component in my app which needs to warn the user about unsaved data when the application shuts down. Putting my alert message in the destructor doesn't work because everything just keeps getting destroyed. I tried overriding 'userTriedToCloseWindow' but it doesn't seem to be being called.
I see the shutdown, systemRequestedQuit, and closeButtonPressed methods in the JUCEApplication and DocumentWindow classes, but these objects aren't really aware of the contents of the app and therefore can't access any of the methods I need.
I'm trying to make my code easily portable between a standalone app and a plugin so I don't want to do anything that's too specific to either one if I can help it. What's the cleanest way to call methods on a child component from the top level? Do I need to create a pointer to that child at the app level? I think what I really want is a 'pre destructor' function for the Component class. Maybe I missed something?
Less importantly, is there a way to make the AlertWindow::showOkCancelBox function use native window and button styles?
Thanks for your help