On Nov 12, 2008, at 4:38 PM, Brad Gibbs wrote:

This works fine for attributes, but I'd also like to create relationships between the new product and existing category and manufacturer objects in the main MOC using pop up buttons. I can populate the pop up buttons easily enough in IB using bindings, but I can't bind across from the main MOC where the categories and manufacturers arrays live into the special new product MOC created for the sheet.

I've mucked about a bit with NSPopUpButton's titleForSelectedItem and some other methods, but, it feels as though I'm fighting the frameworks. Can someone recommend an elegant solution for this?

Since both MOCs should be using the same persistent store, you can "fetch" the related entities into the temporary MOC. This is probably easier than copying them, which would be another alternative.

You might save yourself some headache by using the MOC's undoManager instead of creating a temporary MOC. To do this, get the undo manager, begin an undo grouping. When the sheet is dismissed, end the undo grouping. If the user canceled the sheet, call -undoNestedGroup. This should work both for additions and edits. Works like a charm for me, so far at least.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to