From 485e59b5eb3a2dce8d2576603f334a2f719c0e96 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Mon, 6 Jun 2011 00:11:04 -0400 Subject: [PATCH] More handlesContentAsCompoundValue, although fairly guess-work based. More research needed in the future. --- AppKit/CPObjectController.j | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/AppKit/CPObjectController.j b/AppKit/CPObjectController.j index 476c3fff5..096104a3b 100644 --- a/AppKit/CPObjectController.j +++ b/AppKit/CPObjectController.j @@ -498,7 +498,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo - (CPString)description { - return "<_CPObservableArray: "+[super description]+" >"; + return "<_CPObservableArray: " + [super description] + " >"; } - (id)initWithArray:(CPArray)anArray @@ -710,6 +710,17 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo { [[_controller selectedObjects] setValue:theValue forKeyPath:theKeyPath]; [_cachedValues removeObjectForKey:theKeyPath]; + + // Allow handlesContentAsCompoundValue to work, based on observation of Cocoa's + // NSArrayController - when handlesContentAsCompoundValue and setValue:forKey:@"selection.X" + // is called, the array controller causes the compound value to be rewritten if + // handlesContentAsCompoundValue == YES. Note that + // A) this doesn't use observation (observe: X is not visible in backtraces) + // B) it only happens through the selection proxy and not on arrangedObject.X, content.X + // or even selectedObjects.X. + // FIXME The main code for this should somehow be in CPArrayController and also work + // for table based row edits. + [[CPBinder getBinding:@"contentArray" forObject:_controller] _contentArrayDidChange]; } - (void)setValue:(id)theValue forKey:(CPString)theKeyPath