Re: Bindings, arrangedObjects, and a NSTableView-like view
Re: Bindings, arrangedObjects, and a NSTableView-like view
- Subject: Re: Bindings, arrangedObjects, and a NSTableView-like view
- From: Daniel Jalkut <email@hidden>
- Date: Thu, 21 Apr 2005 09:19:18 -0700
Hi Rob - I'm just a beginner with bindings, too, but maybe my
thoughts on your situation will help us come to a better
understanding of what should happen, or will spur on more experienced
folks to chime in.
On Apr 21, 2005, at 5:12 AM, Rob Giseburt wrote:
Basically, I want to make something like Safari's Downloads window
or Mail's Activity Viewer, where it's a vertically stacked view of
subviews.
An array of stacked objects with interior detail is conceptually
identical to a tableview, except that all of your columns are
"squished" into a single view. So for instance, where "name," "age,"
and "address" might have been columns in a typical table, here you
are putting them all in your view. Where before they could have been
independently managed by NSTableColumn bindings, here something else
will have to manage them.
I would like to be able to bind items (controls, labels, etc) of
the subviews to an
NSArrayController, but I can't figure out how to to the magic that
NSTableColumn seems to do with the 'arrangedObjects' key.
I think the "magic" is just that when an NSTableColumn binds to
arrangedObjects, it knows to use that object combined with the
designated keypath as the "ordered values" for that column.
So looking at things from a data source perspective, binding a column
"MyColumn" to the arrangedObjects object with a key path of "name"
means something along the lines of:
When I get my data source callback, if the column idenitifer is
"MyColumn" then return the object [arrangedObjects valueForKey:@"name"];
For example, when I place a subview in the view, how do I let it
know which arrangedObjects index to look at? How can I even tell
which controls of the subview are bound to the NSArrayController?
Or, do I tell the NSArrayController about the subview?
The arrangedObjects binding is only useful if you are in a position
to know something about how to dole out the contents. I'm thinking
the solution to your problem is going to be not binding the
individual controls of each view, but binding the manager of these
views to the arrangedObjects.
So if you've got view1, view2, and view3 stacked in a row, you'll
need some kind of "Column Manager" object whose "content" (or
whatever you want to call it) is bound to arrangedObjects. When
column manager notices a change in content, it will go through the
list of views and set their values in order from the new value of
arrangedObjects.
As I said, this is my naive take on the problem, and hopefully
somebody more experienced will over more sage advice. My biggest
doubt about this analysis is whether there isn't a better way to
"automatically bind" the independent views to the arrangedObjects,
without the explicit re-assignment by the "Column Manager."
All of this really highlights the value that would come from making
example code available for a reasonably complicated view that exposes
its own bindings. I haven't found many examples along these lines, yet.
Daniel
_______________________________________________
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