On the mac, the following may happen: the user hits the "close" button of the window or
hits "esc". In that case, the panel disappears, but the app is still in the modal run
loop (all interfaces disabled). The only thing I can do is terminate the application.
I guess instead that I should be able to trap that closure and return either
NSAlertAlternateReturn or NSAlertErrorReturn. What do you think? and how? I tried to
implement "performClose" but it doesn't get called in the delegate.
If possible, you should not be using an application modal dialog at all.
If that's not possible, you probably should remove the close button from the
modal dialog and set Esc as key equivalent of the Cancel button.