Thanks for the suggestion Quincey - I have just finished implementing an 
NSTableColumn subclass which does the observing etc, and is working nicely, but 
as you say, it's not the neatest solution. Your idea sounds like an interesting 
one to pursue - I could just make up a dummy property that uses the 
valuesAffecting thing to trigger the update at appropriate times and do the 
work in the tableView's delegate. A lot less code to debug...

(and at the same time, I would have thought that the frameworks should have 
made binding to the title of a button cell a trivial thing to do...)

Gideon

On 18/07/2010, at 6:33 PM, Quincey Morris wrote:

> 
> I think this is unnecessarily complicated. I'd first be inclined to try a 
> much simpler approach. Make the data model property that the table column's 
> "value" is bound to be KVO-dependent on the data model title property. You 
> can likely do this just by defining a 
> +keyPathsForValueAffecting<MyValueProperty> method that returns the title 
> property key, in the relevant data model class.
> 
> That means that if either the value changes or the title changes, a KVO 
> notification is sent to the table column, which causes the corresponding row 
> to be redisplayed. That in turn causes the data cell to be prepared, and so 
> your dataCellForTableColumn delegate method would be invoked, allowing you to 
> transfer the correct title to the button cell.
> 
> I'd seriously try to avoid any solution that involves manually adding KVO 
> observers and removing them later.
> 

_______________________________________________

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

Reply via email to