Re: Using an NSView as a sheet
Re: Using an NSView as a sheet
- Subject: Re: Using an NSView as a sheet
- From: Gregory Weston <email@hidden>
- Date: Fri, 26 Nov 2004 16:50:28 -0500
On Nov 26, 2004, at 3:27 PM, John Spicer wrote:
Is it possible to do this? I have a window (prefs) in one place that
uses it as the content (using setContentView or something like it),
and in another place I need it to come down from the login window as a
sheet.
Is there a way to do this? Otherwise it looks like two nibs and I
guess two copies of the code (which I don't like).
Advice, anyone?
Doesn't take two nibs. Just one that's loaded two times. This is
probably not the most elegant technique, but it works....
+ (void)displayModalForWindow:(NSWindow*)inWindow
{
static MyController* sPanel = NULL;
static MyController* sSheet = NULL;
if(inWindow)
{
if(!sSheet) sSheet = [[MyController alloc]
initWithWindowNibName:@"MyNibFile"];
[NSApp beginSheet:[sSheet window] modalForWindow:inWindow
modalDelegate:sSheet
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
}
else
{
if(!sPanel) sPanel = [[MyController alloc]
initWithWindowNibName:@"MyNibFile"];
[sPanel showWindow:self];
}
}
This is heavily trimmed but I don't think I broke it in the process.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden