Binding NSArrayController's objects to an NSTextView
Binding NSArrayController's objects to an NSTextView
- Subject: Binding NSArrayController's objects to an NSTextView
- From: John Joyce <email@hidden>
- Date: Sat, 26 Jul 2008 21:57:25 -0500
I'm trying to learn to use bindings. Right now, I'm adapting the
venerable RaiseMan example in the 3rd edition of Mr. Hillegass' book.
Of course, in RaiseMan, the NSArrayController and the corresponding
array and its objects are bound to a table view.
What I'm trying to do is bind to an NSTextView that is the backing
of an NSScrollView.
Each object in my array has its own @properties, of course.
Each object has an NSString in it, which I want to use as the text
for the TextView.
Just to see what happens, in my nib I've got these bound both to a
table view as well as a text view.
The table view behaves as you would expect.
The text view gives really bizarre results. It resembles an NSLog
description of an array.
Editing directly in it, gives identical changes to all objects in
the array. Sometimes the results of editing directly in the text
view are just strange!
Any tips on how this should be done? Am I possibly missing something
in my key path or missing some other intermediary thing?
The code is identical to the 3rd edition RaiseMan, but with no
numeric values, only working with strings. (thus the table view has
only one column and headings are not important.)
Oops, perhaps I mailed too soon! Somethings became apparent by
tinkering.
Changing the Controler Key to 'selection' rather than
'arrangedObjects' seems to make a big difference.
I'm still finding bindings to be a bit mystifying. I know what they're
doing conceptually. I just don't get the lingo used and some of the
organization used.
It sure would be nice if there was some sort of humanly intuitive
version more like Ruby and Rails and ActiveRecord things... (maybe
when MacRuby comes around)
_______________________________________________
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