
216 Chapter 8: Creating a Manipulator
Creating a New Manipulator iTool Developer’s Guide
“IDLitManipulator::OnMouseMotion” (IDL Reference Guide) for details. Before
exiting, call our superclass.
Implementing an OnMouseUp Method
The manipulator class OnMouseUp method is called when a mouse up event occurs
over the target window. The method typically includes a call to the
CommitUndoValues method to commit the user’s changes during the mouse
transaction. (This is only required to support undo/redo functionality. See
“Manipulators and the Undo/Redo System” on page 202 for details.)
Example OnMouseUp Method
This OnMouseUp method can be used to reset class structure fields and to close
transactions.
; Configure the mouse up method
PRO ExampleManip::OnMouseUp, oWin, x, y, iButton
IF (OBJ_VALID(self.oImage)) THEN BEGIN
; Commit this transaction.
iStatus = self->CommitUndoValues()
ENDIF
; Reset the structure fields.
self.oImage = OBJ_NEW()
; Call our superclass.
self->IDLitManipulator::OnMouseUp, oWin, x, y, iButton
END
Discussion — This example verifies that there is a valid image, oImage, in the class
structure field. If so, call the CommitUndoValues, which in turn calls the
RecordFinalValues method of the associated operation. Before exiting, call our
superclass. This must be done to update the public instance data fields. Other
available parameters include window coordinates of the cursor and mouse button
information. See “IDLitManipulator::OnMouseUp” (IDL Reference Guide) for
details.
Creating an OnWheel Method
Manipulators based on the IDLitManipulator class can respond to events generated
by the scroll wheel on the user’s mouse. The OnWheel method is invoked in response
to wheel events in the iTool window.