FROM : Sherm Pendley
DATE : Thu Apr 17 22:44:17 2008
On Thu, Apr 17, 2008 at 3:49 PM, Michael Watson <<email_removed>>
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
DATE : Thu Apr 17 22:44:17 2008
On Thu, Apr 17, 2008 at 3:49 PM, Michael Watson <<email_removed>>
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
| Related mails | Author | Date |
|---|---|---|
| Michael Watson | Apr 17, 21:49 | |
| Sherm Pendley | Apr 17, 22:44 | |
| Jean-Daniel Dupas | Apr 17, 23:12 | |
| Michael Watson | Apr 18, 06:45 |






Cocoa mail archive

