IsUndoingOrRedoing property

Microsoft Visio Developer Reference

IsUndoingOrRedoing property

       

Determines whether the current event handler is being called as a result of an Undo or Redo action in the application.

Version added

2000

Syntax

boolRet = object.IsUndoingOrRedoing

boolRet

Required Boolean. True (-1) if the application is firing events related to an Undo or Redo action; otherwise, False (0).

object

Required. An expression that returns an Application object.

Remarks

The IsUndoingOrRedoing property returns True when the application is firing events related to an Undo or Redo action that the user has initiated through the user interface, or which an Automation client has initiated by calling the Undo or Redo method of an Application object.

When the application calls an event handler, the event has a "cause." If that cause is a user action or another event handler, then it is legitimate to perform undoable actions during the course of handling that event. However, if the cause of the event firing is an Undo or Redo action, then the event handler should not perform undoable actions. Doing so eliminates the ability to redo an action.

You will typically only perform undoable actions inside an event handler when this property is False. You can perform undoable actions when the flag is True, but the redo queue is destroyed.