• 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: NSTableView bindings assumptions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView bindings assumptions


  • Subject: Re: NSTableView bindings assumptions
  • From: "Greg Herlihy" <email@hidden>
  • Date: Wed, 31 May 2006 17:32:01 -0700

NSTableView's bindings don't assume anything. Rather they do no more (and do no less) than simply reflect the state of their bound objects. And in fact were one to bind the columns of an NSTableView to an NSArrayController's selectedObjects - but leave its content bound to the NSArrayController's arrangedObjects - then the table's content would be as jumbled as described. The outcome in this case is entirely forseeable.

Furthermore, it is perfectly reasonable to configure a table's bindings to show only the selected objects or object of an NSArrayController - the master/detail arrangement does exactly that. The real issue is that the more sophisticated and powerful the UI for a dataset aims to be - the more consideration and care that will be required to ensure the proper bindings.

Greg

----- Original Message ----- From: "David Catmull" <email@hidden>
To: <email@hidden>
Sent: Wednesday, May 31, 2006 3:17 PM
Subject: NSTableView bindings assumptions



As an experiment, I tried binding an NSTableView's columns to an NSArrayController's selectedObjects instead of arrangedObjects. I was testing a theory that NSTableView assumes it's going to be bound to arrangedObjects and always sets its row count accordingly. I was right.

The result was a table with a row count equal to the number of items in the array, but every item displayed the same data: the contents of the array items corresponding to the table view's selection. It was like browsing a list through a kaleidoscope :)

There seem to be a lot of assumptions and hidden workings when it comes to bindings and table views. Are these details documented anywhere, officially or not? The documentation seems to assume you're always going to do it the normal way, where It Just Works. But I bet knowing what's going on under the hood would help me understand bindings a lot better.

This isn't just idle curiosity either: I'm working on a bindings interface for Carbon controls, since Carbon-Cocoa integration still has a ways to go.

I could also see what happens if I bind each column to a different controller...

--
David Catmull
email@hidden
http://www.uncommonplace.com/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSTableView bindings assumptions (From: David Catmull <email@hidden>)

  • Prev by Date: [WWDC] Food sucks, complain here...
  • Next by Date: Re: Binding popup contents difficulties [REVISITED]
  • Previous by thread: NSTableView bindings assumptions
  • Next by thread: Style Question: accessing methods in the Document
  • Index(es):
    • Date
    • Thread