Just a quick question. I want to change my document to using the GCUndoManager
so I can actually see what's going on with undo in my application. From the
documentation, I would have thought that the following was sufficient in my
NSPersistentDocument subclass's -init method:
GCUndoManager* um = [[GCUndoManager alloc] init];
[um enableUndoTaskCoalescing];
[um setLevelsOfUndo:100];
[[self managedObjectContext] setUndoManager:(id)um];
[um release];
But if I do that, the updateChangeCount messages aren't sent (obviously it's
not listening for the notifications from the new undo manager). However if I
add:
[self setUndoManager:(id)um];
then it appears to be working. Although it is working, I am rather mystified by
this, seeing as the NSPersistentDocument documentation says:
----------------
"setUndoManager: Overridden to be a no-op.
...
Parameters: undoManager - This value is ignored.
Special Considerations: You should not override this method. The persistent
document uses the managed object context’s undo manager."
---------------
In my mind, that's a pretty clear statement that what I am doing should not
work.
Even more interesting is that if I completely remove the:
[[self managedObjectContext] setUndoManager:(id)um];
so that it just sets the undoManager on the persistent document subclass, then
it still works, leading me to believe that the documentation is completely
wrong, and if you call -setUndoManager: on an NSPersistentDocument subclass, it
actually sets it on the managed object context, and on the NSDocument. Correct?
And does that hold true for 10.5 as well as 10.6?
Is what I'm doing OK? Is this a bug in the documentation?
Thanks
Gideon
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]