Re: Grouping undo-able actions with CoreData
Re: Grouping undo-able actions with CoreData
- Subject: Re: Grouping undo-able actions with CoreData
- From: John Timmer <email@hidden>
- Date: Tue, 24 May 2005 19:12:12 -0400
The problem seems a bit weirder than what I first wrote. Some interface
actions that change managed objects will trigger undo management to start,
others won't. Once it's started, they all trigger it, even ones that did
not immediately prior. (more specifically, changing sort descriptors bound
to a managed object using a table column header doesn't trigger undo -
changing a popup menu selection in the table that's bound to a different
managed object will. Once the popup's changed, changing the sort
descriptors is now undo-able).
Taking advantage of this, the dialog I wanted to test for undo-ability will
allow undoing. Unfortunately, it crashes with the stack trace below, none
of which is in my code.
Clearly, it's going to take some playing around to isolate the issue, so
I'll probably wait until I get home tonight to try to figure things out in
more detail. Thanks for the quick feedback and suggestion, though.
#0 0x928970e8 in -[NSException raise]
#1 0x92896f3c in +[NSException raise:format:]
#2 0x9288abac in -[NSObject(NSKeyValueObserverNotification)
didChangeValueForKey:]
#3 0x93ff0280 in -[NSManagedObject didChangeValueForKey:]
#4 0x94009c70 in -[NSManagedObject(_NSInternalMethods)
_updateFromSnapshot:]
#5 0x94005a00 in -[NSManagedObjectContext(_NSInternalChangeProcessing)
_undoInsertions:]
#6 0x92918250 in -[_NSUndoStack popAndInvoke]
#7 0x929180f4 in -[NSUndoManager undoNestedGroup]
#8 0x936be08c in -[NSApplication sendAction:to:from:]
#9 0x93718888 in -[NSMenu performActionForItemAtIndex:]
#10 0x9371860c in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:]
#11 0x9361fb88 in _NSHandleCarbonMenuEvent
#12 0x9361d4ec in _DPSNextEvent
#13 0x9361ce68 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#14 0x936193cc in -[NSApplication run]
#15 0x93709c1c in NSApplicationMain
#16 0x0000b518 in main at main.m:13
>
>> Does anyone have any advice on how to get this to work?
>
> At a first guess, you need to ensure you've invoked
> processPendingChanges.
>
> "Forces the receiver to process changes to the object graph. This
> method causes changes to registered managed objects to be recorded
> with the undo manager. This method is invoked automatically at the
> end of the event loop‹you can also invoke it manually to coalesce any
> pending unprocessed changes."
> (Forthcoming documentation enhancement.)
>
> mmalc
_______________________________________________
This mind intentionally left blank
_______________________________________________
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