Well, I implemented your method and still had issues. Turns out the value binding for the drop-down menu was a secondary issue. After implementing your method, I could verify that changing the property did, in fact, trigger an update in the table. However, the values never changed in UI. The object sent to setObjectValue: in my cell still had the original values.
Turns out the value binding with the drop-down menu was resetting the property. I added a read-only property to my model that just returns the property: @property (assign) BOOL archived; @property (readonly) BOOL isArchived; - (BOOL) isArchived { return archived; } Then, I bound the drop-down menu's value property to isArchived instead of archived, unchecked "Raises for Not Applicable Keys", and voila. Everything works like a charm. All of that said, since this drop-down menu is an "action" menu, it may be better to use the title property of the menu to switch the title between "Archive" and "Unarchive" rather than display a check mark next to "Archive". Anyway, thanks again for your help. On Nov 22, 2012, at 12:16 PM, jonat...@mugginsoft.com wrote: > On 22 Nov 2012, at 18:57, Randy Widell <bornagainsl...@gmail.com> wrote: > >> Right, and in other places it works for me. For instance, I have a window >> with text fields bound to a model object through an object controller. >> Updating properties of the model updates the text fields. >> >> Reading your test below, one thing I was forgetting is that I am not binding >> a column in the table view to any specific property. I have one column >> bound to arrangedObjects and a custom cell that draws all the information >> (think Apple Mail with the subject line and then a snippet below). > I do much the same in an outline control and everything updates via bindings > fine. > The multi property cell output can be seen here. > http://www.mugginsoft.com/kosmictask/help/using#task-view-mode > >> So, I guess it does make sense that the table view does not update. Perhaps >> reloadData after I change the item. > It makes sense. > I presume you update your custom cell via NSCell -setObjectValue and draw > according to the object properties pass in as the argument. > This is fine for when the table is first drawn but there is no way for the > array controller to learn when the model has been updated. > You are bound to the model, not a model property. This makes sense as the > cell state depends on more than one model property . > You need a way of letting the bindings machinery that the model has been > updated. > > What I do is in my model object is to define a bindingObject property that > returns self: > - (id)bindingObject > { > return self. > } > > I then bind a NSTableView column to > arrayController.arrangedObjects.bindingObject. > > Now, in the model, you just set up a dependency between your bindingObject > path and the paths that the custom cell is sensitive to (the affectingKeys in > the sample below). > > + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key > { > NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key]; > if ([key isEqualToString:@"bindingObject"]) > { > NSSet *affectingKeys = [NSSet setWithObjects:@"name", @"image", > @"count", @"hasCount", @"countColor", @"statusImage", @"updating", > @"updatingImageIndex", nil]; > keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKeys]; > } > return keyPaths; > } > > Thus, when, in the example above, I change say the count model property > -didChangeValueForKey:@"bindingObject" is sent and the cell is redrawn using > the new model properties. > > HTH > > Regards > > Jonathan Mitchell > Mugginsoft LLP > > > _______________________________________________ > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/bornagainslakr%40gmail.com > > This email sent to bornagainsl...@gmail.com _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com