Re: NSTableColumn value binding + keypath over a relationship
Re: NSTableColumn value binding + keypath over a relationship
- Subject: Re: NSTableColumn value binding + keypath over a relationship
- From: Quincey Morris <email@hidden>
- Date: Tue, 29 Sep 2009 16:21:57 -0700
On Sep 29, 2009, at 15:27, Stamenkovic Florijan wrote:
// the group dragged to
NSManagedObject* group = [((NSTreeNode*)proposedParentItem)
representedObject];
// the URIs of Notes being dragged
NSArray* noteURIs = [NSKeyedUnarchiver
unarchiveObjectWithData:[pboard
dataForType:FSNoteIDURIsArrayPBType]];
NSUndoManager* um = [[group managedObjectContext] undoManager];
// relate the notes to the group dragged into
// do it as a single undoable op
[um beginUndoGrouping];
for(NSURL* noteURI in noteURIs){
// app delegate is the where the managed object URI -> managed
object reference logic resides
FSNote* note = (FSNote*)[appDelegate objectForURI:noteURI];
note.group = group;
}
[um endUndoGrouping];
I dunno, this is where my head starts to hurt.
According to your error message, there was an observer of a Note
(well, FSNote) object for key path "group.name". However, your binding
is via arrangedObjects. Now, although the array controller may be KVO
compliant for the property "arrangedObjects", the arrangedObjects
array isn't itself KVO compliant for anything, because arrays just
aren't. So although 'note.group = group;' is generating the correct
notification, maybe it just isn't "flowing through" the array
controller to the binding mechanism.
I'm going to take a stab in the dark and predict that you *don't* have
"rearranges content automatically" checked for the array controller,
and that checking it will cause the error message to go away. (Or,
equivalently, you could send a "rearrangeObjects" message to the array
controller immediately after 'note.group = group;'.)
Alternatively, you could move to a small island in the Pacific and
forget you ever heard of NSArrayController. ;)
_______________________________________________
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:
This email sent to email@hidden