Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems extending NSPersistentDocument Core Data Tutorial



Ok, I've got part of my question answered (RTFM http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdChangeManagement.html#/ /apple_ref/doc/uid/TP30001201, section Communicating Changes Between Contexts). Managed object contexts are not synchronized and that is the way how it should be according to the documentation. However, I've tried to implement solution 2 from that document (reset second managed object context) to no avail. I've reset the second moc but the departments still do not show up. Do I have to save the first moc? It seems that way (it works when I save before opening the new object sheet). That's definitely not what I want. I don't want to force the user to save the document just that the departments show up in the new object sheet. How can I make the added departments visible in the new object sheet?

Simon

On Nov 18, 2007, at 9:42 PM, Simon wrote:

Hi

I want to extend the core-data application from the NSPersistentDocument core data tutorial with some additional functionality. I've added a sheet to manage a tree of departements. The Department entity has two additional relationships, a parent and an inverse children relationship. I've successfully managed to bind an NSTreeController and an NSOutlineView. Now, I want to add an NSPopupButton to the new object sheet which allows to choose the department for a new employee.

However, if I launch the application and add some departments and then try to add a new employee, the NSPopupButton is not updated (that is, it stays empty). If I save the document, reopen it and add a new employee, the popup button is properly populated. Below the changes I've made in the new Employee Sheet NIB.

* NSArrayController for the departements
** managedObjectContext bound to managedObjectContext of File's Owner
* NSPopupButton for the departements
** Content bound to array controller arrangedObjects
** Content Values bound to array controller arrangedObjects key path name
** Selected Object bound to Object Controller arrangedObjects key path department


If I bind the array controller's managedObjectContext to the documentManagedObjectContext of File's Owner, the popup menu is populated (I can't complete the sheet because the department is from a different managed object context and that is obviously not allowed). How can I make sure that the changes from the departments sheet are visible in the new object sheet's popup button?

Thanks
Simon

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden
References: 
 >Problems extending NSPersistentDocument Core Data Tutorial (From: Simon <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.