That's what I can't get to work, that's where I'm still confused. This piece
of code here:

-----------------
if (!myCustomSheet)
        [NSBundle loadNibNamed: @"MyCustomSheet" owner: self];

[NSApp beginSheet: myCustomSheet
       modalForWindow: window
       modalDelegate: self
       didEndSelector: @selector(didEndSheet:returnCode:contextInfo:)
       contextInfo: nil];
----------------

I get that "myCustomSheet" is an NSWindow reference, but how does it know to
be the particular window I want to show? When the nib is loaded, where does
it go (in code)? How do I connect the window in the MyCustomSheet XIB to an
outlet in the AppDeletegate file? I am stuck there...


In your [ NSBundle loadNibNamed .. ] what's 'self' the owner you've given it, is that your AppDelegate subclass? That's how you hook this up.

In IB you have 'Files Owner' which is going to be whatever object you pass into the loadNibNamed call. So add an outlet to that (IBOutlet property of type NSWindow* or similar called whatever makes sense to you), then hook up the window in your XIB to that property of File's Owner.

Now the window is in [ self whateverPropertyYouCalledIt ] after the NIB has loaded.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to