Re: Preventing Undo Registration when inserting into the MOC (managed object context)
Re: Preventing Undo Registration when inserting into the MOC (managed object context)
- Subject: Re: Preventing Undo Registration when inserting into the MOC (managed object context)
- From: email@hidden
- Date: Thu, 2 Mar 2006 15:04:41 -0800
On 18/03/02, at 13:42, email@hidden wrote:
Just an update, I got it working by maintaining an undo group through
(past) an even in the run loop by setting a variable that lets the
object that performs the insertion know that an undo group is open,
it then closes it upon insertion into the MOC. It works perfectly so
far!
So looks like this:
NSRunloop (begin event)
- array controller add:
- undoManager -beginGrouping
- array controller setUndoIsGrouped; (Instance variable in my class)
NSRunloop (end event)
NSRunloop (begin event)
- table column -setNeedsDisplay:
- myItem -valueForKey:
- managed object context -insertObject: (HERE TURNING OF UNDO
RESTORATION DOES NOT WORK APPARENTLY
- myItem checkIfUndoIsGrouped (check the class in question)
- myItem endGrouping (if checkIfUndoIsGrouped returns YES)
- myItem (return value)
NSRunloop (end event)
Hi list.
Currently, I have a value that is created passively, only when
called in valueForKey.
This value is taken from a managed object that is created to supply
the value.
And this value is only requested after being inserted into an array
controller (its returning a value displayed in a table column).
I though disabling undo registration would fix this, but it doesn't
because I get a "shadow" undo after insertion into the moc.
Also, creating an undo group wont work because after inserting an
object into the array controller, the runloop finishes its current
event, so by the time my "shadow" object is inserted, its too late
to group it into the same undo group (IOW, making an undo group in
- add: method of NSArrayController doesn't work).
Here is what I'm observing:
NSRunloop (begin event)
- array controller add:
NSRunloop (end event)
NSRunloop (begin event)
- table column -setNeedsDisplay:
- myItem -valueForKey:
- managed object context -insertObject: (HERE TURNING OF UNDO
RESTORATION DOES NOT WORK APPARENTLY)
- myItem (return value)
NSRunloop (end event)
So, then clicking undo only un-does the last event (NSManagedObject
_undoInsertions:)
How can I let the object context insert an object but have it not
register it in the undo stack? (The inserted object deletes itself
upon save it its "empty" anyways so its OK to have it "invisible")
Thanks in advance!
Andre
email@hidden
_______________________________________________
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
Andre
email@hidden
_______________________________________________
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