Can I bind the contentArray of an NSArrayController to selectedObjects.array of another?
Can I bind the contentArray of an NSArrayController to selectedObjects.array of another?
- Subject: Can I bind the contentArray of an NSArrayController to selectedObjects.array of another?
- From: joe OneNinetyTwo <email@hidden>
- Date: Mon, 28 Aug 2006 03:10:42 -0700 (PDT)
I have a model class that contains a string and an
array. For example,...
@interface Person : NSObject {
NSString *name;
NSMutableArray *friends;
}
The array "friends" will contain wrapped NSString
objects.
I want to have two NSTableView's: a personsTableView
to display the names of the Person objects, and a
friendsTableView to display the strings in friends FOR
the person name selected in the personsTableView.
I've tried a dozen or so ways to do this with
bindings, but I always come to a dead end.
My approach has been..
(1) Create a nib for my AppController.m (subclass of
NSWindowController).
(2) Set up a personsController NSArrayController in
the nib to manage an array of Person objects,
(3) bind personsController's contentArray to File's
Owner (model key path : persons).
persons is an NSMutableArray in AppController.m
(4) set up a personsTableView NSTableView (with one
column) and bind its NSTableColumn value to the
personsController and arrangedObjects.name
(All by itself, the personsTableView works fine.)
Here's comes the tricky part...
--------------------------------
(5) Set up a friendsController NSArrayController in
the nib to manage an array of MyString objects.
@interface MyString : NSObject {
NSString *string;
}
I had to wrap an NSString, so I could make it a
keyValue compliant object.
(6) bind friendsController's contentArray to
personsController (model key path :
selectedObjects.friends).
(7) set up a friendsTableView NSTableView (with one
column) and bind its NSTableColumn value to the
friendsController and arrangedObjects.string
But the error I get is...
[<NSCFArray 0x3bcd30>
addObserver:forKeyPath:options:context:] is not
supported. Key path: string
I've tried dozens of other ways of doing this with
bindings, but this way seems to me to be the most
reasonable. Any suggestions of how I'm going wrong
and possible solutions would be greatly appreciated.
Thanks,
Phil
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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