Folks;

This one is driving me mad!
I'm trying to bust up an overly complicated xib into 2 xibs - the main xib and 
a preference xib

I've started completely over trying to implement a pref xib -- no CoreData just 
bare bones….

I have created a brand new subclass of NSWindowController: Pref2Controller
        there is not a single line of code in this object nor any instance 
variables.
I have created a brand new xib file: ptest
        XCode creates the xib with a FilesOwner, FirstResponder, Application, 
and Window (set to releaseOnClose and visibleAtLaunch)
I have set the FilesOwner to be an instance of Pref2Controller (using IB)
I have set the window outlet of the FilesOwner to point to the NSWindow object 
(using IB)
These two are the only changes I've made to ptest.xib
When I use this code in the appDelegate:

- (IBAction) configure:(id)sender {
        if (!prefPanelController) {
                prefPanelController = [[Pref2Controller alloc] 
initWithWindowNibName:@"ptest"];
        }
   [prefPanelController showWindow:sender];
}

The new ptest.xib window will open once but never again if I close it.
        this is true regardless of whether I set the window to releaseOnClose 
or not
        this is also true regardless of whether I have hooked up the window 
outlet or not
                logging [pController window] shows (null) regardless of whether 
I have outlet assigned or not
                as well as regardless of whether prefPanelController already 
exists or has just been alloc'ed and init'ed..

What I am just not understanding here?
Please?
Steve

On May 20, 2010, at 10:08 PM, Steve Cronin wrote:

> Folks;
> 
> I have a feeling that this is an embarrassing one so try and go easy on me…
> XC 3.2.2 
> 
> I have a main nib that opens a window and that works fine.
> I used to have an NSPanel in this nib to handle preferences.
> I've decided it's a good idea to split the nib into two different nibs: the 
> main nib and a preferences nib.
> 
> I've looked over the Sketch project and used it as a model.
> I've also read over the Document-Based App Overview FAQ
> 
> I've added a window nib to the project and then subclassed a 
> NSWindowController.
> I've made the xib's files owner this window controller
> At this point I can get a simple empty window to open just fine.
> 
> However, I'm using CoreData and I want to pass the existing MOC to the pref 
> window:
> I have added an array controller to the pref nib with its MOC set to files 
> owner's MOC in IB.
> The controller manages an entity not a mutable dictionary.
> MOC is a synthesized property of the PrefController (the windowController 
> mentioned above).
> 
> if (!prefPanelController) {
>       prefPanelController = [[PreferencesController alloc] 
> initWithWindowNibName:@"testPref"];
>       [prefPanelController setManagedObjectContext:[self 
> managedObjectContext]];
> }
> [prefPanelController showWindow:sender];
> 
> No window opens and I get a console error:  Cannot perform operation without 
> a managed object context
> 
> Could someone give me the gentle head slap I need here?
> Steve


_______________________________________________

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