The duplicate problem is likely fixed by giving the tee controller a fetch predicate in IB. Set the predicate to something like parent==nil. This will obviously depend on what you've called your 'parent' property.

I've blogged about doing this with drag and drop in core data and non- core data apps.

http://espresso-served-here.com

HTH

Jon

On 15 Jul 2008, at 22:59, "Sean McBride" <[EMAIL PROTECTED]> wrote:

Hi all,

I have an outlineview populated by binding to a treecontroller.  It
displays CoreData entities of type "Person". "Person" has 'parent' and
'children' relationships.  Displaying everything works fine.

Now the outlineview must support drops.  In my windowcontroller, I
implement outlineView:acceptDrop:item:childIndex: and look for my custom
pasteboard type.  If it's there, I need to create a new "Person"
entity.  How should I do this?

I have tried:
a) [myTreeController add:nil];

b) Person* person = [myTreeController newObject];
   [person setParent:...];

c) Person* person = [NSEntityDescription
     insertNewObjectForEntityForName:@"Person"
     inManagedObjectContext:moc];
   [person setParent:...];

In all cases, the outlineview shows 2 of the new person. The problem is
not on the model side, since if I close and reopen the window, only 1
new person is there.

Thanks,

--
____________________________________________________________
Sean McBride, B. Eng                 [EMAIL PROTECTED]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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/j.p.dann%40gmail.com

This email sent to [EMAIL PROTECTED]
_______________________________________________

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