• 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: "Paul Gribble" <email@hidden>
  • Date: Wed, 1 Aug 2007 17:45:41 -0400

Something tells me I would need a different NSArrayController if the #
items in each NSTableColumn will be different ... otherwise I don't
quite understand how a single NSArray in myDocument will handle this
...

On 8/1/07, Paul Gribble <email@hidden> wrote:
> OK I think I need to restate the problem.
>
> The user starts out seeing a table with one column. User can hit a button
> and add values to that column (e.g. 10 values). Then at some later point
> the
> user can hit another button, and add a new column entirely. That column
> starts out empty, and like with the first, the user can incrementally add
> any number of values (not necessarily the same # as in the first column).
>
> Here's how I am starting out:
>
> My myDocument has an instance variable NSArray *data and the getter and
> setter methods for data and setData.
>
> I have one NSArrayController in my nib file called dataController. In IB I
> have added one key to dataController list of keys, called "col1". the
> dataController is then bound (by pointing and clicking in IB) to my
> myDocument instance variable "data".
>
> I have one NSTableView in my nib with, at start, one column. That column
> (by
> pointing and clicking in IB) is bound to the dataController using a key I
> added called "col1".
>
> I have a button labeled "addcolumn", which is connected to an IBAction in
> myDocument called addColumn. I guess what I need to do in that method is:
>
> 1. create a new NSTableColumn and add it to the NSTableView. (I can do
> this,
> no prob).
> *2. create a new key for dataController called col2 (how do I do this
> programmatically?)
> 3. programmatically bind the new NSTableColumn to the dataController new
> key
> "col2" (I know how to do this from looking at mmalc's example binding code)
>
> Am I on the right track?
>
> Thank you!!
>
>
>
> On 8/1/07, Sean McBride <email@hidden> wrote:
> >
> > On 8/1/07 4:17 PM, Paul Gribble said:
> >
> > >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
> >
> > This has been discussed on this list in the past, you should be able to
> > find discussions in the archives.  As I recall, one solution is to have
> > all the columns in the nib, bind them up, then simply hide them at run
> > time if you don't want them.
> >
> > --
> > ____________________________________________________________
> > Sean McBride, B. Eng                 email@hidden
> > Rogue Research                        www.rogue-research.com
> > Mac Software Developer              Montréal, Québec, Canada
> >
> >
> >
>


--
Paul L. Gribble, Ph.D.
Associate Professor
Dept. Psychology
University of Western Ontario
London, Ontario
Canada N6A 5C2
Tel. +1 519 661 2111 x82237
Fax. +1 519 661 3961
email@hidden
http://bubba.ssc.uwo.ca
_______________________________________________

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

References: 
 >dynamically adding NSTableColumns while using bindings (From: "Paul Gribble" <email@hidden>)
 >Re: dynamically adding NSTableColumns while using bindings (From: "Sean McBride" <email@hidden>)
 >Re: dynamically adding NSTableColumns while using bindings (From: "Paul Gribble" <email@hidden>)

  • Prev by Date: Re: Usefulness of a Cocoa DSP framework?
  • Next by Date: SSL support in NetSocket
  • Previous by thread: Re: dynamically adding NSTableColumns while using bindings
  • Next by thread: Re: dynamically adding NSTableColumns while using bindings
  • Index(es):
    • Date
    • Thread