Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom sheets without going application modal?



Hey, List.

My application pulls up a custom sheet to enter some new-record info. Every example I've ever seen to get a custom sheet working uses something like the following:

- (IBAction)openSheet:(id)sender{
[NSApp beginSheet:mySheet
modalForWindow:[NSApp keyWindow]
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
[NSApp runModalForWindow:mySheet];

[NSApp endSheet:mySheet];
[mySheet orderOut:self];
}

And then some button or another on the sheet ends the modal session with a:

- (IBAction)closeSheet:(id)sender{
[NSApp stopModal];
}

Correct me if I'm wrong, but this takes the *whole application* modal, right? As opposed to, say, alert sheets which are document modal only? Isn't this an interface inconsistency? Shouldn't a user assume that, if a sheet on one window has opened, she could still use the program's menu or manipulate other windows in the same app?

What is the danger in me implementing the above like so:

- (IBAction)openSheet:(id)sender{
[NSApp beginSheet:mySheet
modalForWindow:[NSApp keyWindow]
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
// not going modal!
// [NSApp runModalForWindow:mySheet];

// these are moved to the sheet's button's action
// [NSApp endSheet:mySheet];
// [mySheet orderOut:self];
}

- (IBAction)closeSheet:(id)sender{
// no longer needed (we're not modal).
// [NSApp stopModal];

[NSApp endSheet:mySheet];
[mySheet orderOut:self];
}

Or am I going completely backwards with all of this?

Cheers,
-josh emmons
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.