• 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: dynamically adding NSTableColumns while using bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamically adding NSTableColumns while using bindings


  • Subject: Re: dynamically adding NSTableColumns while using bindings
  • From: Ashley Mills <email@hidden>
  • Date: Thu, 2 Aug 2007 00:05:33 +0100

I've spent a week trying to figure out the same problem. I've got an NSTableView that represents a football (soccer!) league. Each column represents a different team in that league, and each cell in the column contains a player in the team (up to a max of, say, 15). I want to dynamically add teams (NSTableColumns) to the table view, and tried binding each one to one of an array of NSArrayControllers. The first column displays OK, but each subsequent one shows only '(' in each cell. I can get around this by setting a datasource, but I'd rather do it with bindings if possible.

Searching the archives, I found this thread... http://lists.apple.com/ archives/cocoa-dev/2005/Jun/msg00044.html, which seems to indicate that it's not possible, but doesn't indicate an alternative solution.

Any ideas welcome.

Cheers
Ash




From: "Paul Gribble" <email@hidden> Date: Wed, 1 Aug 2007 16:17:48 -0400
So I have figured out from the various demo code, etc, how to use
KVC-compliant setters and getters in myDocument.m, which enables me very
easily, with very little code, to implement a NSTableView, use bindings to
bind each NSTableColumn to an NSArrayController, and bind each
NSArrayController to an NSMutableArray instance variable in myDocument.m.


Here's my question: What if I want the user to be able to dynamically add or
remove columns? How do I set things up using bindings so that when the user
clicks "add column", a new column appears, is bound to a new nsarray
controller, which is turn bound to a new NSMutableArray in myDocument.m? I
guess what I need in myDocument.m is an NSMutableArray (or maybe
NSMutableDictionary?) that in turn stores NSMutableArrays, one for each
NSTableColumn? But then I'm at sea when it comes to how to set this all up
with bindings.


Thanks,


_______________________________________________

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


  • Prev by Date: Re: dynamically adding NSTableColumns while using bindings
  • Next by Date: Re: Core Data compound keys
  • Previous by thread: Re: dynamically adding NSTableColumns while using bindings
  • Next by thread: Re:dynamically adding NSTableColumns while using bindings
  • Index(es):
    • Date
    • Thread