On Dec 6, 2009, at 04:36, Graham Cox wrote: > On 06/12/2009, at 10:57 PM, Mike Abdullah wrote: > >> But why are you opening a group without registering an undo action? Why not >> just wait until the first action actually needs to be registered? > > I tried it but it doesn't work. I forget the details now as this was my first > approach and that was a long time ago, but basically the undo manager didn't > tolerate having groups deferred until a task was actually received. It would > crash, but without the code, I couldn't say why .
I'm not sure I understand this point. Are you talking about a situation with 'setGroupsByEvent:YES' or 'setGroupsByEvent:NO'? Either way, an explicit call to 'beginUndoGrouping:' is *by definition* deferred, since it obviously can't happen the instant an event is dequeued. The length of time between dequeuing an event and invoking an undo manager method seems irrelevant. But I ask mainly out of curiosity because ... > My fourth approach is to write my own bloody undo manager and have done with > it. Result so far - bliss. I think that's a perfectly reasonably thing to have done. The functionality described by the NSUndoManager docs certainly doesn't *seem* difficult to re-implement. I haven't tried it, but now you have, and you've pretty much verified that fact. It's also interesting that the documentation: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/UndoArchitecture/Articles/UndoManager.html#//apple_ref/doc/uid/20000205-CJBDJCCJ has this statement (in the overview): > An undo manager collects all undo operations that occur within a single cycle > of the run loop, so that performing an undo reverts all changes that occurred > during the cycle. Taken literally, that would seem to say that NSUndoManager's API contract doesn't support undo actions that span events. FWIW. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com