Re: Problem with binding selectionIndexes of an NSArrayController
Re: Problem with binding selectionIndexes of an NSArrayController
- Subject: Re: Problem with binding selectionIndexes of an NSArrayController
- From: Keary Suska <email@hidden>
- Date: Sun, 29 Jul 2007 12:06:19 -0600
- Thread-topic: Problem with binding selectionIndexes of an NSArrayController
on 7/29/07 5:47 AM, email@hidden purportedly said:
> Anyway, I have a project which contains two NSArrayControllers, one
> called "ItemSets" and one called "ScreenData". Each ItemSet object in
> the ItemSets array has an ivar called "selectedScreen", an int which
> is intended to store which screenData object is selected in the
> ScreenData array. The idea is that when the user selects a different
> itemSet object, a different screenData object will be displayed in
> the inspector.
>
> To do this, I bound ScreenData's selectionIndexes to my ItemSets
> controller with controller key "selection" and model key path
> "selectedScreenIndexes". Then, in my ItemSets object, I set
> "selectedScreenIndexes" to be a dependent key of "selectedScreen",
> and the selectedScreenIndexes accessor generates an NSIndexSet
> containing one index: selectedScreen. (If you're wondering why I need
> the int at all, it's because some controllers on my window are bound
> to it).
Unless there is something missing in your explanation, the "ScreenData"
NSArrayController seems like the wrong approach. If you are doing a
master-detail interface (see
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Task
s/masterdetail.html#//apple_ref/doc/uid/20002090), this controller is
pointless and superfluous.
If you need "ScreenData" for some other purpose, then I would say don't use
it at all for this particular function.
It has always seemed to me that NSControllers don't like to bind to each
other unless it is in a hierarchical fashion, and even then there can be
issues. In your case, where you have two array controllers on the same
level, well, as you see you can run into trouble.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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