Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
- Subject: Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
- From: Scott Ahten <email@hidden>
- Date: Mon, 3 Jan 2005 18:08:01 -0500
On Jan 3, 2005, at 3:34 PM, James Dessart wrote:
On Mon, 3 Jan 2005 10:29:51 -0800, mmalcolm crawford
<email@hidden> wrote:
I can get stuff to work, but I don't understand why the stuff I got
to
work does what it does. It's very click-and-pray. I've would love to
see an example of NSArrayController with just one basic type --
NSStrings.
As has been stated on several occasions on this list, because bindings
rely largely on key value coding, strings do not work well as a model.
Typically you need at least a dictionary.
But if you want to do a list of strings, how would you go about doing
that? That's the question he's asking, I think. I'm not sure he wants
the example to do anything more than just list an array of simple
strings.
James
While I'm just getting up to speed on Cocoa Bindings, the bindings
system appears to be designed to automate passing values back and forth
between the application's model and UI. The issue with using a NSString
as a binding source is that it *is* a value, not a model object that
contains values.
While the array that the NSArrayController manages could be thought off
as "The Model", individual table rows are bound to corresponding
objects in the array. If it is a NSString, you're binding the entire
row to a single value, not a row model object. Since rows often contain
more than one value, the bindings system expects a model object that
can return multiple named values for each column in the row, like a
NSDictionary, etc., not a single value.
NSArrayController adds and removes model objects from your array and
interfaces with the bindings framework. As a controller, it's not part
model, but serves as the glue (along with the bindings framework)
between your model and UI.
- Scott
- -
:: email@hidden
:: http://www.pixelfreak.net
- -
_______________________________________________
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