• 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
Saving state of NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Saving state of NSOutlineView


  • Subject: Saving state of NSOutlineView
  • From: Renaud Boisjoly <email@hidden>
  • Date: Mon, 9 Jun 2003 22:14:57 -0400

I've found this post on saving the state of the NSOutlineView:

When I'm creating my dataSource object:

[outline setAutosaveName:@"Subscriptions Outline"];
[outline setDataSource:dataSource];
[outline setDelegate:dataSource];
[outline setAutosaveExpandedItems:YES];

In the data source:

- (id)outlineView:(NSOutlineView *)outlineView
persistentObjectForItem:(id)item {
//return a string representing item
}

- (id)outlineView:(NSOutlineView *)outlineView
itemForPersistentObject:(id)object {
//return the item represented by object, the string returned earlier
}

And it's that simple.


But to me, its still not that simple. there's still al little piece missing. The author states that you must return a string representing the item in the first and then the item represented by the string in the second.

But its not clear what is actually going on. Am I supposed to simply return some arbitraty string? A unique string for each item? How does this string link with the actual item being collapsed or expanded. Should it be the content of said item or just a unique name? Or perhaps am I supposed to return a unique string and when this string is called, return the object it corresponds to in my datasource?

I just need a bit of info to understand when this is called... perhaps a simple code example... I feel I'm not too far but it doesn't compute and I notice a lot of others have asked this.

Anybody have some sample code of an NSOutline which saves its state after a save?

Thanks for any pointers

- Renaud
_______________________________________________
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.

  • Prev by Date: Knotted Threads
  • Next by Date: Re: NSWindow resizing hack?
  • Previous by thread: Re: Knotted Threads
  • Next by thread: Re: Saving state of NSOutlineView
  • Index(es):
    • Date
    • Thread