Undo selection of object in table view (Core Data app)
Undo selection of object in table view (Core Data app)
- Subject: Undo selection of object in table view (Core Data app)
- From: "Arthur C." <email@hidden>
- Date: Wed, 27 Sep 2006 17:23:47 +0200
I have a table view in a Core Data application, and suppose I have 5 objects
in it.
Now I can select, say object 4, modify an entry, then select object 1.
If I want to undo the change to object 4, I can use the undo button and the
change is undone. But the selection does not jump to object 4 again, it
remains at object 1.
I would like to add an action to the undo manager whenever a different
object is selected in the table view (so selection is restored after hitting
'undo').
There is (partial) sample code to do this in the Undo Architecture guide,
but that does not involve table views.
The undo manager can be retrieved from the managed object context using
NSUndoManager * undoManager = [[[NSApp delegate] managedObjectContect]
undoManager];
Questions:
- how can I get access to the table view for which to add the selection
undo?
- The row selection can be set, as I understand it, using the
selectRowIndexes:byExtendingSelection method. What worries me is that the
row selection undo will go wrong if the user decides to sort the table
according to one of the columns. This changes the row indexes with respect
to the row contents, and does *not* respond to undo (so I'd rather have undo
for sorting actions as well...). So, what would be the way to go?
- I suppose I'm not the first person to want this... I've been unable to
find helpful material in the list archives. Isn't there a ready-made
solution for all this?
Thanks for your time,
Arthur C.
_________________________________________________________________
Live Search, for accurate results! http://www.live.nl
_______________________________________________
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