What app is this with?
I figured out part of the problem.
Our plugin shows a progress bar (AIUser->UpdateProgress()) due to the length of time it takes to modify the artwork. The progress bar is shown before the extension has a chance to close. When this happens, the extension can't close. When I comment out the UpdateProgress code, the artwork is modified and the extension closes just fine.
Another problem now presents itself: when the artwork is modified, nothing shows up for the Undo. I am pushing the AppContext right before the artwork is modified (using the AppContext.hpp/cpp class). I can't prove this yet, but I'm willing to bet that pushing the AppContext doesn't work as long as the extension window is still open.
So, how to close the extension window before the plugin gets the event. That's what I need to figure out.
Why don't you use CSXSInterface to request the extension to close and then catch the event the same way you are with escape?
This still doesn't work. The extension window is still open when the plugin gets the close notification, no matter how I approach it. I think at this point I'm giving up and reworking the dialog to be modeless. It shouldn't take two developers working on this for 4 days to try to figure out how to close a window.
Harbs, thanks for your suggestions.
At least on Mac, when a native dialog is shown on an modal extension window, both window's event handling get stuck.
The workaround I took was to use AITimerSuite.
When you receive an event, do nothing but store the event data and then activate a timer.
After the modal extension is closed, the timer fires and the plugin can do the queued job.
Hope this helps someone who cannot take modeless approach.
Hi ranvis, Nelson, Harbs
Are you get pressed ESC event before Modal dialog escape ?