Re: Using bindings to make an NSPopupButton to assign an array filter predicate
Re: Using bindings to make an NSPopupButton to assign an array filter predicate
- Subject: Re: Using bindings to make an NSPopupButton to assign an array filter predicate
- From: James Farwell <email@hidden>
- Date: Mon, 18 Dec 2006 15:52:30 -0800
On Dec 18, 2006, at 3:08 PM, Matt Neuburg wrote:
I must stress, as I have often done in the past, that the first
step in a
decent understanding of bindings is to expunge the word "magic"
from one's
conceptual vocabulary. Nothing magical or mysterious happens.
It is true that when you bind an NSTableColumn's value to an
NSArrayController, it is effectively the NSTableView itself that
ends up
bound to the NSArrayController's arrangedObjects (the content),
selectionIndexes, and sortDescriptors. (I say "effectively" because
in fact
there is an intermediate NSTableBinder object.) But that isn't
magic - it's
more like a convenient shorthand.
It is also true that when you bind from an interface item or
NSController,
it sets up KVO in both directions, since otherwise synchronization
would not
result. But that isn't magic either; in fact, it's a slog (as you
can see
from mmalc's GraphicsBinding example, which demonstrates the sort
of thing
an interface item does in response in a bind: call).
Now, having said all that, if you think this material is inadequately
presented in the documentation, then please file a bug against it.
Your
evaluation of the documentation's usefulness to a beginner will
never be as
keen as when you are one! m.
Yeah, the bi-directional KVO relationship is much clearer to me now
as a result of my mistake. It does make perfect sense that binding
NSPopupButton's selectedIndex to NSArrayController's selectionIndex
permits the popup button to not only display the selection, but also
change it.
The table view thing is still fairly confusing though because I find
it rather unintuitive that binding a column of a table to a
particular property of an array controller actually ends up binding
the selection of the entire table to the selection of the entire
array controller. I haven't been able to actually find documentation
that discusses it anywhere, and I'd think it'd be rather important to
mention since it makes things like binding multiple tables to a
single array controller a "Bad Thing" whereas it seems perfectly
reasonable if you don't know about that particular quirk. Do you
know of an official Apple document that actually details this
interaction and/or NSTableBinder? Also, if I were interested in
filing a bug against the documentation, what system would I use to do
it? I'm still pretty new around here, after all.
Thanks!
James
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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