Re: How to load a sheet in a separate Nib file
Re: How to load a sheet in a separate Nib file
- Subject: Re: How to load a sheet in a separate Nib file
- From: Scott Anguish <email@hidden>
- Date: Thu, 28 Aug 2003 02:06:00 -0400
On Aug 27, 2003, at 7:12 PM, Fei Li wrote:
>
Thanks for responding. I've already do what you mentioned here but
>
still have some questions.
>
>
The sheetController is derived from NSWindowController. I wonder if
>
the sheetController must be derived from NSWidnowController or can
>
just from NSObject.
>
it can be either...
>
How can I get sheet and sheetController from my main controller?
>
Because in [NSApp beginSheet: sheet modalForWindow: [self window]
>
modalDelegate: sheetController didEndSelector: nil contextInfo: nil];
>
I must have an sheet object already, how can I get this? Use
>
[NSBundle loadNibNamed: @"SheetDialog" owner:sheetController ]; I need
>
sheetController object which I also don' t have. I get these two
>
object by connect sheetController and sheet to my main controller, but
>
I don't think it's the correct way?
You don't need to connect the sheet to the main controller, you can
create an accessor on sheetController for that. Mind you, all the
sheet management stuff should be in sheetcontroller.
You could just use the main controller for the sheet owner as well..
>
>
Thanks for any information!
>
Fei
>
>
>
On Wednesday, August 27, 2003, at 04:45 PM, Scott Anguish wrote:
>
>
>
>
> On Aug 27, 2003, at 5:41 PM, Fei Li wrote:
>
>
>
>> If anybody have idea about this? I read some articles and document
>
>> for
>
>> using sheet in cocoa, but they all put the sheet in the same nib file
>
>> of the main window and use main controller or the controller in the
>
>> main nib file to control the element on the sheet.
>
>>
>
>
>
> This isn't sheet specific, just the usual dance for dealing with
>
> multiple nibs.
>
>
>
> From your code, you'd already have an object called sheetController
>
> that has been created. In the sheet nib, set the File's Owner to be
>
> the class that sheetController is. Then add an outlet for the sheet
>
> to the SheetController class and connect the sheet to the File's
>
> Owner in IB, and do that outlet. Make sure that you're target
>
> actions for buttons and such also connect to File's Owner and then
>
> the target action.
_______________________________________________
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.