Allow Undo/Redo with different tools

I have several different tools a user can select and I override it so the previously selected tool is automatically reselected instead of going back to the default tool.
My problem is you can only undo/redo when the default selection tool is active. I've tried calling this.Tool.Stop, setting this.Tool to the default tool and then calling the base.KeyDown() handler but I still cannot perform Undo/Redo.
What am I missing?

public override void DoKeyDown() {<BR>      GoInputEventArgs evt = this.LastInput;<BR>      if (evt.Control && evt.Key == Keys.Z) {<BR>        this.View.Undo();<BR>      } else if (evt.Control && evt.Key == Keys.Y) {<BR>        this.View.Redo();<BR>      } else {<BR>        base.DoKeyDown();<BR>      }<BR>    }<BR>

When I call view.CanUndo() or view.CanRedo() the return false because the other tool is selected. Is there a way to override this?


Sorry, I thought you were asking how to let the user type ^Z/^Y to do an Undo or Redo while your custom Tool was active.
Usually your problem is caused by mismatched start/end transaction calls resulting in nested transactions that are never finished. More precisely, there are more StartTransaction calls than there are calls to FinishTransaction or AbortTransaction (or EndTransaction). That would cause GoUndoManager.CanUndo() and CanRedo() to return false.
You can check this by looking at the value of GoUndoManager.TransactionLevel, which ought to be zero when “nothing” is going on.