[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPanel and modal run loop

From: Wolfgang Lux
Subject: Re: NSPanel and modal run loop
Date: Wed, 12 Jun 2013 10:45:56 +0200

Riccardo Mottola wrote:

>> 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.
> Well, logically the request is modal, the user shouldn't perform any other 
> actions until he inputs the data. Usually modal panels should be easy to do, 
> so I guess I'm missing something here.
> It looks you suggest more some kind of workaround? or is the "close" button 
> incompatible with a modal panel? I tried some google-gu, but found nothing of 
> use.

If you want to have a close button in your modal panel then you should use 
either your own subclass of NSPanel and override the -performClose: method 
there or you should use one of the methods that is called on the window 
delegate, namely -windowWillClose:.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]