Archiving NSTableViews
Archiving NSTableViews
- Subject: Archiving NSTableViews
- From: Glenn Zelniker <email@hidden>
- Date: Wed, 21 Apr 2004 12:57:05 -0400
I have a problem with archiving and unarchiving NSTableViews. I've
already found a solution, but it's inelegant and was hoping there would
be a better way to do it.
My application is document-based. The Nib file has a table in it that
begins life with two columns. During the life of the application, the
table is changed programmatically -- the number of columns, the column
headers, the column identifiers, etc. When I archive the tableView, the
table unarchives with the specs defined by the Nib file. And because
the two columns from the Nib agree with the first two columns of the
unarchived table (these two columns never get changed
programmatically), the first two columns and their data agree with one
another. But the rest of the table isn't there.
The way I figured to get around the problem is to unarchive the table
object to a "dummy" NSTableView in the loadDataRepresentation:ofType
method. Then in the windowControllerDidLoadNib method I go through the
columns of the dummy table and append them to the table that comes out
of the Nib file. And it works fine, I should add, but it seems
inelegant. I was wondering if there's any way to suppress the
extraction of the table from the Nib file and "drop" the proper table
into the correct place in the GUI. In other words, I like using IB to
put the table in the right place, put a NSBox around it, and configure
the table and I don't want to have to do that programmatically, but at
the same time the way I'm doing it now seems kludgy.
Any suggestions?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.