On 4/6/09 2:10 PM, Jon C. Munson II said: >So, I agree Sean that the auto-increment set is being done in a different >"pass" than the actual add. > >However, it seems adding a record can be undone (and redone presumably) - >just need to press Undo twice. > >While that works, I don't think it is the right way to do things. And, one >shouldn't have to sprinkle custom Undo/Redo code everywhere just to bundle >the two actions together. This could be a major headache if an add causes >all kinds of child-adds too.
Turns out it's easy to have it working properly. Just do this in your 'delay 0' method. [[self managedObjectContext] processPendingChanges]; [[[self managedObjectContext] undoManager] disableUndoRegistration]; [self setValue:[NSNumber numberWithInt:highestIdNumSoFar] forKey:@"idNumber"]; [[self managedObjectContext] processPendingChanges]; [[[self managedObjectContext] undoManager] enableUndoRegistration]; -- ____________________________________________________________ Sean McBride, B. Eng [email protected] Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
