Quincey-

I have not created a controller in code, to my knowledge, so I don't know how 
I'd have two. (I had, previously, made this error by creating an instantiation 
of NSDocument in IB, but I realized the error in my ways and cleared that up, I 
believe, by resetting the File's Owner to the MyDocument subclass. which is not 
instantiated in IB). I can't see any evidence that I missed any part of fixing 
that.

What I have done is dragged an NSArrayController into the nib file, assigned it 
to the MyVSController subclass, then wired it to the NSTextView. I used code to 
create the table columns and bindings. The NSArrayController behaves properly 
(able to show an array of arrangedObjects, make decisions based on these, etc.) 
prior to saving the file. I *HAD* tried creating and assigning an 
NSManagedObjectContext object in IB, but realized that was probably a mistake 
so I removed it and any reference in code to such a thing.

The original code did not include the rearrangeObjects call. I put that in to 
be certain I wasn't missing something that would trigger a re-filtering, thus 
revealing contents that were otherwise filtered out.

The last line of code is simply a way to set an NSDatePicker in the UI to the 
last clock time the user had chosen. I didn't bind the NSDatePicker because I 
wanted to be able to do a number of parameter checks on it before allowing its 
value to slip into the data store. Nevertheless, I agree that the situation 
seems to suggest that the File > Open ("load") method that is being invoked by 
the NSPersistentDocument is creating a new managed object context that is not 
being attached to the controller. Despite my efforts to force this issue (such 
as posting the new MOC in a notification object), it fails. I assume this is 
because I was using the NSPersistentDocument persistent store assignment 
method, which occurs before the Nib is reconstituted, meaning that the value is 
lost in the initialization.

I don't know if this is a clue, but I have never been able to get this program 
to respond to the request for [[NSApp delegate] managedObjectContext]. I DO 
have a delegate to the Application, but I have not yet done anything with it. 
Could this be part of the problem?

In any event, I appreciate any further insight you or anyone else might have.

Thanks again.

-Dan_______________________________________________

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