• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArrayController and variable number of NSTextFields
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController and variable number of NSTextFields


  • Subject: Re: NSArrayController and variable number of NSTextFields
  • From: Matt Neuburg <email@hidden>
  • Date: Sat, 03 Feb 2007 09:39:21 -0800
  • Thread-topic: NSArrayController and variable number of NSTextFields

On Sat, 3 Feb 2007 08:29:16 -0600, Kevin <email@hidden> said:
>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.

Why not actually *use* an NSTableColumn (in an NSTableView)? That is the
usual interface for displaying a variable number of values. Users will like
this better than fields that come and go. And it will work with no further
work on your part; you will have a classic master-detail bindings
architecture, on which there is a great deal of documentation already. m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



_______________________________________________

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

  • Follow-Ups:
    • Re: NSArrayController and variable number of NSTextFields
      • From: Kevin <email@hidden>
  • Prev by Date: Re: key path blues
  • Next by Date: Re: NSTextView font for inserted text
  • Previous by thread: NSArrayController and variable number of NSTextFields
  • Next by thread: Re: NSArrayController and variable number of NSTextFields
  • Index(es):
    • Date
    • Thread