Multiple NSArrayControllers bound to an NSObjectController
Multiple NSArrayControllers bound to an NSObjectController
- Subject: Multiple NSArrayControllers bound to an NSObjectController
- From: "Boris Yeltsin" <email@hidden>
- Date: Fri, 9 Nov 2007 00:52:41 -0800
I have a model object that has a name and an array attribute. I have an
array of these model objects bound to an NSArrayController. I can then feed
another NSArrayController with the array attribute of each model object to
create a master-detail inteface. I have one NSTableView that displays the
model objects' names and then another NSTableView that shows the model
object's array properties.
This works fine. However, as I have been extending this interface
(incorporating drag 'n drop), I have come up against design issues,
particularly in the area of undo. I have been creating a lot of code to make
sure that when I make a change to an NSArrayController's arrangedObjects
array that any changes which are undone affect the correct model object's
array. I have to keep track of sortDescriptors, insertion and deletion
indexes, etc.
As a consequence, I had an idea. What happened if my model object also had
an NSArrayController in code. When I change selection in the array of my
model objects, the detail NSTableView is connected to my model object's
NSArrayController. I feel like this would obviate a lot of management issues
I am currently experiencing.
My array of model objects is bound to an NSArrayController. I thought I
could use an NSObjectController and bind it to the
selection.controllerkeyPath of the NSArrayController that controls my
model objects and use that
to populate my NSTableView, but it is not working.
Does anyone have any insight? I can include a test session.
Boris
_______________________________________________
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