Re: Binding to a specific element in an array
Re: Binding to a specific element in an array
- Subject: Re: Binding to a specific element in an array
- From: Kevin <email@hidden>
- Date: Sun, 4 Feb 2007 14:30:57 -0600
I have a related question. I posted the following yesterday but
didn't get any answers:
I have a Core Data application which consists of two entities, Item
and Attribute. Item has to-many relationship with Attribute. In the
application, Items are displayed in an NSTableView bound to an
NSArrayController. I have a second NSArrayController which holds the
selected Item's attributes.
When the user clicks an Item in the table, I'd like to show each of
its Attributes using a set of NSTextViews (one NSTextView per
attribute) housed in a custom NSView. Since an Item can have any
number of Attributes, I need to create a variable number of
NSTextViews and dynamically bind them to the second NSArrayController
which holds the selected item's attributes.
The issue is that there doesn't appear to be a way where individual
NSTextViews can be bound to indices in an NSArrayController. i.e. If
an Item has 3 attributes, I need to bind textview1 to index0,
textview2 to index1 and textview3 to index2. In essence, it'd be
similar to how NSTableColumn works with NSArrayController.
I know I can do this portion manually (without using bindings) but
I'd like to avoid writing code that manages the content of the text
views.
Is there any way this can be done using bindings?
Kevin
On Feb 4, 2007, at 1:35 PM, I. Savant wrote:
On Feb 4, 2007, at 2:13 PM, Stuart Rogers wrote:
Yes, and definitely far less time than the amount I've already
spent trying to do it all without glue code.
So it would seem. :-)
I'm a creature of habit, and I tend not to waver from the first
way I find to get a job done, so I wanted to be sure that there
wasn't a quicker method than by using glue code.
Well, as I said, there may be, but I don't think there is. The
approach I suggested will certainly work just fine.
--
I.S.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40xheadsoftware.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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