Re: dynamically adding and binding NSTableColumns
Re: dynamically adding and binding NSTableColumns
- Subject: Re: dynamically adding and binding NSTableColumns
- From: "Jonathan 'Wolf' Rentzsch" <email@hidden>
- Date: Sun, 7 Nov 2004 12:25:39 -0600
mmalcolm crawford, email@hidden, wrote:
>> What am I doing wrong? I suspect it lies on the fact I'm using multiple
>> NSArrayControllers with a single NSTableView.
>>
>That could be it... :-)
>
>Dynamic addition/removal of table columns certainly does work if you
>use a single array controller and key paths. Is there any reason you
>want to use multiple controllers?
Yes, since my data model is really just an array of columns, not an array
of rows (dictionaries). The columns are created and named by the user, so
there's really no key paths there to hook up. That is, I have columns of
strings, not rows of dictionaries.
I probably could hack something up using autogenerated key paths, but I
think I'd be fighting the design.
I realize I'm being too abstract here, so here's my little working app
with source code:
<http://rentzsch.com/share/TruthTable-0.zip> (56K)
It's a small unfinished app that generates truth tables given user input.
>One particular issue you may want to consider in future is how to
>dynamically associate localised table column headers. This may be
>"fiddly" if you do everything programatically.
I'm doing this all programatically since I have no idea what the user is
entering. If they want to enter Japanese table column headers, they can
be my guest :-)
>An alternative, if
>possible, is to create your entire user interface in IB in advance, and
>at runtime remove and cache those columns you don't need, adding them
>back as needed...
Yes. I read that advice on your excellent "Cocoa Bindings Examples and
Hints" page. It seemed kinda hacky, so I wanted to try a "pure" approach
first.
I decided to just use an old-fashioned table data source, which works a
treat.
Thanks for the help!
| Jonathan 'Wolf' Rentzsch http://rentzsch.com
| Red Shed Software http://redshed.net
| "better" necessarily means "different"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden