Override closeButtonPressed() in a DialogWindow

Hi,

I am having the same issue as the user at this link.

I have a class that inherits from DialogWindow, which I am using to create a non-modal window using:

LaunchOptions::create()

I am looking to override the closeButtonPressed() function in order to handle how the window is closed.

However, if you step into any of the launch or run functions in this structure, it seems that a DefaultDialogWindow is always created, i.e.

DialogWindow* DialogWindow::LaunchOptions::create()
{
    jassert (content != nullptr); // You need to provide some kind of content for the dialog!

    return new DefaultDialogWindow (*this);
}

Similarly to the linked post, I cannot override closeButtonPressed() in my class successfully, because the window’s close button callback always triggers the overridden function inside the DefaultDialogWindow class. I am also not able to inherit from the DefaultDialogWindow class.

What is the correct way for my derived class to override DocumentWindow::closeButtonPressed() whilst maintaining non-modality? I feel like I’m missing something.