On 1/26/09 12:21 PM, Ulai Beekam said: >> IIRC that happens when you insert the object directly into the managed >> object context without going through the array controller. >> >> I.e. by using NSManagedObject's >> >> -initWithEntity:insertIntoManagedObjectContext: >> >> instead of NSArrayController's >> >> -addObject: > >This is actually what I'm most interested about, and the reason why I >asked my question in the first place. Can someone else here confirm >this? Let me repeat what is to be confirmed: When a new managed object >is added to the managed object context (NB: Directly going through to >the context and NOT using arrayController's add: methods), is it true >that the arrayController will not select that particular object? > >If this is true, it seems strange to me, as this new object will get >propagated to the arrayController and hence the arrayController should >detect that it is a newly added object and therefore select it >automatically, right? > >Remember that throughout this discussion we assume that the "select on >insert" checkbox is checked for the arrayController.
I know what you're talking about. You want to create a new object, you want it to appear in the table, you want it to be selected, and you also need to set some attributes/relationships that you cannot in awakeFromInsert. The problem is that NSArrayController's -addObject: does not return to you the pointer to the new managedobject, and so you cannot customise it. OTOH, if you use -initWithEntity:insertIntoManagedObjectContext:, then it won't be selected in the arraycontroller/table. I have been looking for the best solution for some time now. Here's something I read recently on the topic: <http://boredzo.org/blog/archives/2008-11-26/how-to-work-with-a-bound-to- array> -- ____________________________________________________________ Sean McBride, B. Eng s...@rogue-research.com 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com