• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Binding to title of NSButtonCell in a table view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding to title of NSButtonCell in a table view


  • Subject: Re: Binding to title of NSButtonCell in a table view
  • From: Gideon King <email@hidden>
  • Date: Sun, 18 Jul 2010 19:09:02 +1000

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 (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

References: 
 >Binding to title of NSButtonCell in a table view (From: Gideon King <email@hidden>)
 >Re: Binding to title of NSButtonCell in a table view (From: Quincey Morris <email@hidden>)
 >Re: Binding to title of NSButtonCell in a table view (From: Gideon King <email@hidden>)
 >Re: Binding to title of NSButtonCell in a table view (From: Quincey Morris <email@hidden>)
 >Re: Binding to title of NSButtonCell in a table view (From: Gideon King <email@hidden>)
 >Re: Binding to title of NSButtonCell in a table view (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Initializing unichar variable with a human readable letter
  • Next by Date: Encrypting data in a Core Data SQL store for a Mac desktop app
  • Previous by thread: Re: Binding to title of NSButtonCell in a table view
  • Next by thread: Re: Cocoa-dev Digest, Vol 7, Issue 745
  • Index(es):
    • Date
    • Thread