Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUndoManager - grouping undo actions in Core Data



I am having trouble getting the desired behavior for undoing actions in a CD app. My immediate problem is that I would like to group some actions across events.

I tried [undoManager beginUndoGrouping] with a matching [undoManager endUndoGrouping], but I get a crash when undoing. The app was quite stable without grouping the actions.

I then tried calling
[undoManager beginUndoGrouping];
[undoManager setGroupsByEvent:NO];

- it must be done in this order, or no undo group gets created

I then call [undoManager endUndoGrouping] after the last update to my managed objects... Now everything works like I would like as far as grouping actions.

The problem is that I am unable to successfully re-enable grouping by event. I call [undoManager setGroupsByEvent:YES], and then [undoManager groupsByEvent] returns YES. But when I try to update another managed object without manually creating an undo group, I get an exception that "NSUndoManager is in an invalid state, must begin a group before registering undo"

So how can I re-enable grouping by event? Or how can I group actions without first disabling grouping by event?

Dave
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.