Re: Determining which sheet closed with panels in separate nibs
Re: Determining which sheet closed with panels in separate nibs
- Subject: Re: Determining which sheet closed with panels in separate nibs
- From: "Sherm Pendley" <email@hidden>
- Date: Thu, 17 Apr 2008 16:44:17 -0400
On Thu, Apr 17, 2008 at 3:49 PM, Michael Watson <email@hidden>
wrote:
> Inside of MainMenu.nib, I have my application's main window. Also in
> MainMenu.nib is an NSObject subclass instance that is the main window's
> delegate.
>
> In another nib, I have a panel and an NSObject subclass instance that is
> the panel's delegate. The panel is opened attached as a sheet to the main
> window.
>
> When the sheet is closed on the main window, I need to do some things, so
> I implement -[NSWindow windowDidEndSheet:] in the main window's delegate.
> The problem is that I have other panels I attach as sheets to this window in
> different situations, and I need to distinguish between them so I take the
> correct action for the specific sheet that has closed.
When you open the sheet with
-beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:, assign
your controller as the delegate, and create a
-didEndSheet:returnCode:contextInfo: method in your controller. That way,
the contextInfo that you specified when opening the sheet will be passed
back to your delegate method when it closes.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden