totally confused by bindings settings
totally confused by bindings settings
- Subject: totally confused by bindings settings
- From: Daniel Child <email@hidden>
- Date: Wed, 04 Jun 2008 01:05:14 -0400
I worked out a super basic bindings case where table columns display
the ivars of a Word class via bindings. Words have three ivars with
standard accessors. An ArrayController manages a table of these words,
with appropriate bindings between the columns and ivars. It works as
expected. So far so good.
Now, however, I want to bind the same table to an intervening class,
WordList, which contains an array of Words. And having looked at a
number of tutorials, as well as most of Apple's documentation, I'm
still at a loss as to the exact rationale used in setting bindings as
well as whether you need an additional custom controller (e.g. MailApp
demo).
I tried setting the ArrayController's class to WordList, and bound the
value of individual table columns to
ArrayController.arrangedObjects.wordList.<Word ivar>. (wordList is the
mutable array in the WordList class.) That didn't work. It appears I
can add and remove lines to the table, but the values I type in do not
display after I tab out to the next column.
I tried a few other settings which struck me as less logical, and
predictably they too didn't work. This looks like a basic case where I
shouldn't need any code. What methods / settings could I be missing in
this case?
More importantly, could someone clarify the rhyme and reason for
choosing when to:
- binding the content arrangedObjects versus
- binding the value (of table cells) to arrangedObjects.<ivar> versus
- binding the contentArray to selection.<ivars?>
Apple's Figure 13 of Cocoa Bindings Programming Topics takes a huge
leap from the trivial case of two simple controls (slider and
textfield) to a maze of connections between and among columns and
controllers. I simply don't see when to choose among the various
options, or what they stand for.
I realize there is the additional complication of whether the base
model class employs ivars (as in my "Word" class) or a dictionary of
properties (as in the MailApp demo). But I don't even want to go there
yet. The fact that some tutorials employ a custom controller and
others don't is also confusing as I don't see the clear design
rationale behind one and the other. Presumably you need a custom
controller if you will have actions not provided automatically by the
canned controllers (add, remove, insert, next, etc.). But the
rationale for connections between the custom controller and
NSController object also don't see that clear to me.
_______________________________________________
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