NSArrayController and variable number of NSTextFields
NSArrayController and variable number of NSTextFields
- Subject: NSArrayController and variable number of NSTextFields
- From: Kevin <email@hidden>
- Date: Sat, 3 Feb 2007 08:29:16 -0600
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 NSTextFields (one NSTextField per
attribute) housed in a custom NSView. Since an Item can have any
number of Attributes, I need to create a variable number of
NSTextFields 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
NSTextFields can be bound to indices in an NSArrayController. i.e. If
an Item has 3 attributes, I need to bind textfield1 to index0,
textfield2 to index1 and textfield3 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
fields.
I searched the archives and found some topics discussing a similar
issue but no real solutions. Any insight would be greatly appreciated.
Kevin
_______________________________________________
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