Undo a Delete

Discussion created by Grieck on Dec 14, 2011
Latest reply on Dec 15, 2011 by agray1
Hello Forum,

Is it okay to call IMxDocument.OperationStack.Undo() inside an OnStopOperation() event?

The only way I've gotten the below to work is by calling IMxDocument.OperationStack.Undo() and then executing an esriEditor.SaveEditCommand inside the OnStopOperation().

I'm using a class extension with IObjectClassEvents. When a feature is deleted on the map I am successful in trapping the delete event. However, I ask the user some verifying questions prior to permitting the delete to finish.

The problem I'm having is I can't seem to get the delete to "undo", and here's the key, while keeping the feature still visible on the screen and not having anything in the undo redo cache.

I want the undo to:
1) Keep the feature on the map unchanged, no refresh, start and stop editing etc.
2) Not have any undo or redo cache related to the event.

I've tried several variations of IEditor3 and IWorkSpaceEdit2 start and stop editing and undo's but nothing seems to get this exact solution. I can get it where the feature remains unchanged on the map without having to do a manual start stop edit but then I'm left with a redo option. Also, I wouldn't want to completely clear the undo redo cache but possibly just remove the feature delete and that's it.