Re: NSBeginAlertSheet not waiting for button to be pushed

Chad Leigh -- ObjectWerks Inc <chad+macosx-AU1NHruoRJaEK/[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Feb 7, 2010, at 5:15 PM, Adam R. Maxwell wrote:

> 
> On Feb 7, 2010, at 3:29 PM, Chad Leigh -- ObjectWerks Inc wrote:
> 
>> 
>> On Feb 7, 2010, at 4:01 PM, Christiaan Hofman wrote:
>> 
>>> 
>>> 
>>> Again, if that function does not have the window context, it should not use a sheet but a panel.
>> 
>> Again, in this case, it does not matter since there is only ever one window and there is no way for a system window to get popped up or any other window or panel.  This is not the problem why the routine is falling through.  
> 
> Not that it helps much, but I was able to display a sheet with NSBeginAlertSheet on utility windows in an app I wrote, back about the time you wrote yours.  I just added a didEndSelector argument to it, and it was called after dismissing the sheet.  Are you sure yours isn't being called?  
> 
> As Christiaan just pointed out, NSBeginAlertSheet will return immediately, and your callbacks will only be invoked after the sheet is dismissed.  Sheets only block input to a single window, so that function has to return immediately.


Thanks to Christiaan and Adam getting through my hard head.  I figured out where my thinking went wrong (or at least understanding of what I originally did almost 7 years ago in 2003 and had not looked at since).  The other places that this was running and working there was no code to fall through to -- it just returned to the runloop so gave the impression to me of running in a blocking style.  This particular problem place had actual code afterwards so it was obvious it was not working "the same" to me (when it really was).

The joys of getting back into coding and especially old code after a long long absence. 

Thanks for your patience guys!

Chad
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.