Re: Autosaving the selection in an NSTableView
Re: Autosaving the selection in an NSTableView
- Subject: Re: Autosaving the selection in an NSTableView
- From: Martin Stanley <email@hidden>
- Date: Tue, 14 Apr 2009 11:48:51 -0400
Thanks.
Your idea of storing this kind of meta-data in the database is
interesting. Since I am a Cocoa and CD newbie, would you mind
elaborating on your method please? For example, in which callback do
you set the array controllers' selection? When do you save the current
selection? How do you call setSelectionIndexes with "a delay of 0.0"?
(Sorry if these are obvious questions).
Martin
On 14-Apr-09, at 1:40 AM, Volker in Lists wrote:
Hi Martin,
I archive the selectionIndexes of the array controller and store
them within thecore data document's metadata. I think you need to
serialize (archive) the selectionIndexes to be able to save it
either in NSUserDefaults or anywhere else.
When loading a CD document I check if the meta data have the
appropriate entry, and if so, call the array controllers
setSelectionIndexes method with a delay of 0.0 (to get it executed
in the next run loop). Works like charm.
Volker
Am 13.04.2009 um 05:32 schrieb Martin Stanley:
I have a core-data document-based application that uses a
NSTableView with an NSArrayController as its data source. I have
managed to figure out the magic IB incantations required to save
the column sort, order and hidden data to the shared
NSDeafulsController.
What I would like to do is to also save the current selection of
the table across application invocations. I have tried the obvious:
- bind the array controller's selected indexes to the Shared
Defaults controller - no luck
- bind the tableview's selected indexes to the Shared Defaults
controller - no luck
I even tried to get the select programmatically, but when I tried
the callback methods I thought appropriate:
- windowControllerDidLoadNib
- applicationDidFinishLaunching
I found that the array controller was not yet loaded with data and
therefore had no selection.
_______________________________________________
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