• 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: Dynamically loading NIB files into sheets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamically loading NIB files into sheets


  • Subject: Re: Dynamically loading NIB files into sheets
  • From: Sebastian Celis <email@hidden>
  • Date: Mon, 15 Apr 2002 17:47:11 -0500

Again, thanks, j o a r, for all of your help.

Ok, I've fixed all of the compiler errors I mentioned earlier (some were pretty stupid), but now I have another problem.

First, here are the updates I've made since my last e-mail. Some of them involve the overall structure of the program...

I've decided to make a different Controller class for each of the different sheet types since there are going to be a lot of them, each with a lot of unique code. One all-powerful SheetWindowController was not going to do it for me.

So, in my Document-Based application, I have a SheetContainer (a subclass of NSObject), which is basically just an object with an NSMutableDictionary containing the various SheetControllers that I have loaded thus far, allowing me to load them faster if I need to use them again (which I will).

So, when I push the button on the document window, I invoke the following code:

- (IBAction)openSheet:(id)sender
{
id theSheetController;
int tag = [[thePopUp selectedItem] tag];
NSString *sheetIdentifier = [self sheetIdentifierForTag:tag];

switch(tag)
{
default: // temporarily default until I get the code working
theSheetController = [sheetController sheetControllerForIdentifier:sheetIdentifier];
}

[NSApp beginSheet:[theSheetController window]
modalForWindow:myDocumentWindow
modalDelegate:theSheetController
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:nil];
}


What happens when I run this code, is:
1) the Document window appears
2) I push the button
3) the sheet appears but is _not_ attached to the document window. I think that this has to do with the line in the sheet creation:

modalForWindow:myDocumentWindow

Right now, myDocumentWindow is an (NSWindow *) that I connected to the document window using Interface Builder. But... myDocument already had a "window" outlet connected to the window, and so now there are two outlets associated with the window... "window" and "myDocumentWindow". I have tried using "window" in the above code, but it is not recognized. If I put something nonsensical instead of "myDocumentWindow" and run the program, the same thing happens, which is why I think my problem is with that line.


So, am I not connecting things correctly? I just need to get the beginSheet method to recognize my selected document window.


Thanks,

Sebastian Celis
_______________________________________________
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.

  • Follow-Ups:
    • Re: Dynamically loading NIB files into sheets
      • From: j o a r <email@hidden>
References: 
 >Re: Dynamically loading NIB files into sheets (From: j o a r <email@hidden>)

  • Prev by Date: Re: NSFileManager and aliases
  • Next by Date: Re: NSFileManager and aliases
  • Previous by thread: Re: Dynamically loading NIB files into sheets
  • Next by thread: Re: Dynamically loading NIB files into sheets
  • Index(es):
    • Date
    • Thread