DialogWindow launchAsync exitModalState

If I use DialogWindow with LaunchOptions and launchAsync, how do I know when my component called exitModalState? Is there something I can hook into - a callback or as a listener - to catch this?

My solution so far is to call exitModalState and call a custom notify listener function, but I wonder if there's a simpler way of doing this?

Obviously using showModalDialog would do exactly this, as it waits until the dialog is closed then returns the result from exitModalState, however Android doesn't have this.

You could do something in the window's destructor?

Or there's a whole set of classes you can use to get these events: see ModalComponentManager::Callback

I was looking for a pre-existing callback like the AlertWindow has?

Found it...

SomeComponent *component = new SomeComponent();
DialogWindow::LaunchOptions options;
DialogWindow *window = options.launchAsync();
ModalComponentManager::getInstance()->attachCallback(window, ModalCallbackFunction::forComponent(someCallback, this));

I get my callback with the modal result. Couldn't find this in the demo for dialogs.