Saving State of NSOutlineView in Document-based App
Saving State of NSOutlineView in Document-based App
- Subject: Saving State of NSOutlineView in Document-based App
- From: "Kirt Cathey" <email@hidden>
- Date: Sun, 27 Mar 2005 01:11:48 +0000
Hi All,
I have complrehensively searched this archive and the web for answers on
this, but the existing responses to numerous other requests are sparse or
euphemistic at best.
We have a document with an array of NSAttributedStrings that get posted to
multiple NSTextViews, with an NSOutlineView that controls which item in the
array will display in the text views. When I save the document the outline
view is not saved in the final state that it is displayed in.
After reviewing another posting in this archive, I added the following in
the init portion of the data source.
[outline setAutosaveName:@"Subscriptions Outline"];
[outline setDataSource:dataSource];
[outline setDelegate:dataSource];
[outline setAutosaveExpandedItems:YES];
Then in the data source also added the following methods:
- (id)outlineView:(NSOutlineView *)outlineView
persistentObjectForItem:(id)item
{
return [NSKeyedArchiver archivedDataWithRootObject:item];
}
- (id)outlineView:(NSOutlineView *)outlineView
itemForPersistentObject:(id)object
{
return [NSKeyedUnarchiver unarchiveObjectWithData:object];
}
All of which is verbatim off of the existing archives. Upon debugging, the
first set of
statements included in the data source init section are called, but the
associated methods are not called at all.
Isn't there an easier way to just 'archive' or 'package' in some way the
outline view state when the document is saved? All of the tutorials and
examples are not document-based applications, so that does not help much
with the 'saving' challenge either.
Thanks in advance.
From the desk of ..........
Barking Frog
email: email@hidden
_________________________________________________________________
日本国内最大級570万ユーザーのMSN Hotmail
https://registernet.passport.net/reg.srf?id=2&lc=1041
_______________________________________________
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