• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using an NSView as a sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Using Keychain for storing archived object ?
  • Next by Date: Re: Coding Standards For Objective C
  • Previous by thread: Using an NSView as a sheet
  • Next by thread: NSView within a table column
  • Index(es):
    • Date
    • Thread