On Sep 17, 2011, at 10:25 AM, Torsten Curdt wrote:

> You are suggesting that this is not OK?

Holy cow that's bad! Sheets are supposed to be document modal, not application 
modal. So it's wrong right there.

Next, you don't have to display the window before [NSApp runModalForWindow:], 
because the runModalForWindow will display the window, order it front, make it 
key, etc.

Next, you don't have to order the window out either, because [NSApp stopModal] 
will take care of that.

The last 2 points of course are assuming you're doing it normally, not trying 
to make it a sheet & application modal at the same time.

In other words, to display a modal dialog, this works:

        DebugReportTests_WC *wc = [[DebugReportTests_WC alloc] 
                                                                
initWithWindowNibName: @"DebugReportTests"];
        [NSApp runModalForWindow: [wc window]];
        [wc autorelease];

And to get rid of it in response to a cancel button, this works:

        [NSApp stopModal];

Of course if you want a document-modal sheet, that's a different question--ask 
it if you need to ;-)

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to