Re: NSUndoManager and runModalForWindow: (again)
Re: NSUndoManager and runModalForWindow: (again)
- Subject: Re: NSUndoManager and runModalForWindow: (again)
- From: Kevin <email@hidden>
- Date: Mon, 16 Nov 2009 20:41:04 -0600
After some more experimenting: It works for the first few edits after
which the behavior reverts to "undo/redo in bunches". And you're
right, I shouldn't have to do setGroupsByEvent:NO when in fact it's
the opposite of what I want.
In short, this remains an issue. I'm perplexed as to why the undo
manager behaves this way. I've read the docs over and over again and
aside from setRunLoopModes: method, which I'm calling with
NSModalPanelRunLoopMode, there's no mention of any special
considerations when using it with modal windows.
Kevin
On Nov 16, 2009, at 3:21 PM, Kyle Sluder wrote:
On Mon, Nov 16, 2009 at 1:08 PM, Kevin <email@hidden>
wrote:
Maybe try abandoning -groupsByEvent?
I did and it worked. Calling [[self.temporaryMOC undoManager]
setGroupsByEvent:NO] did the trick.
Although I'm ecstatic that it worked, I'm not sure why it did. Many
thanks
for suggesting that.
Well it really shouldn't have, unless I'm completely mistaken. Here's
what should have happened in my mind:
- Top of run loop
- Incoming click on "show modal window" button (or other UI event
causing this code to execute)
- Main document undo manager opens undo group
- UI event dispatched
- Temporary MOC created
- Temporary undo manager created
- Modal runloop mode assigned to temporary undo manager
- Temporary undo manager assigned to temporary MOC
- Start modal runloop
- Temporary undo manager opens undo group
- End modal runloop iteration
- Incoming user-mucks-with-field event
- Begin modal runloop iteration
- Temporary undo manager opens undo group
- Text field records undo event for user-mucking
- End modal runloop iteration
- Begin modal runloop iteration
...
So this should have worked out of the box.
--Kyle Sluder
_______________________________________________
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