
Chapter 8: Creating a Manipulator 203
iTool Developer’s Guide Manipulators and the Undo/Redo System
Capturing Information for the Undo/Redo System
The initial and final values of the manipulated item must be recorded so that the
operation can be undone and redone. Two manipulator object methods allow you to
specify when values are initially recorded and committed. The RecordUndoValues
and CommitUndoValues methods work in conjunction with the operation defined
during manipulator initialization by the OPERATION_IDENTIFIER keyword. The
RecordUndoValues and CommitUndoValues methods are inherited by classes that
subclass from IDLitManipulator.
The RecordUndoValues Method
The RecordUndoValues method records the initial values of the item being
manipulated. This method is typically called in the OnMouseDown or OnKeyboard
method of an interactive manipulator. When called, the manipulator retrieves the
associated operation and calls the operation’s RecordInitialValues method. See
“Creating a RecordInitialValues Method” on page 174 for more information on this
method.
If your manipulator uses the built-in SET_PROPERTY operation, the initial value of
the property specified in the PARAMETER_IDENTIFIER is recorded and
automatically transacted when you call the RecordUndoValues method. See
“Implementing an OnMouseDown Method” on page 213 for a short example.
The CommitUndoValues Method
The CommitUndoValues method records final values resulting from the manipulator
action. When a transaction is completed, call the CommitUndoValues method to
place initial and final values into the undo/redo buffer. This method is typically called
in the OnMouseUp method or OnKeyboard method of an interactive manipulator.
When called, the manipulator retrieves the associated operation and calls the
operation’s RecordFinalValues method. See “Creating a RecordFinalValues Method”
on page 175 for more information on this method.
If your manipulator uses the built-in SET_PROPERTY operation, the final value of
the property specified in the PARAMETER_IDENTIFIER is recorded and
automatically transacted when you call the CommitUndoValues method. See
“Implementing an OnMouseUp Method” on page 216 for a short example.