
Chapter 8: Creating a Manipulator 213
iTool Developer’s Guide Creating a New Manipulator
required. It is always safest, however, to create a Cleanup method that calls the
superclass’ Cleanup method.
See “IDLitManipulator::Cleanup” (IDL Reference Guide) for additional details.
Example Cleanup Method
The following example code shows a very simple Cleanup method for the
ExampleManip manipulator:
PRO ExampleManip::Cleanup
; Clean up superclass.
self->IDLitManipulator::Cleanup
END
Discussion
Since our manipulator’s instance data does not include any pointers or object
references, the Cleanup method simply calls the superclass Cleanup method.
Creating Mouse Event Methods
Manipulators based on the IDLitManipulator class have the ability to respond to
mouse events generated by the user. The OnMouseDown, OnMouseMotion, and
OnMouseUp methods are invoked in response to mouse events in the iTool window.
The functionality of an interactive manipulator can be divided among these events.
Implementing an OnMouseDown Method
The manipulator class OnMouseDown method is called when a mouse down event
occurs on the target window. Calling the superclass
IDLitManipulator::OnMouseDown method selects items at the mouse location and
fills in the values of the
ButtonPress, nSelectionList and pSelectionList
instance data fields. See “Using Manipulator Public Instance Data” on page 204 for
more information on these fields. The
x
,
y
window coordinates of the cursor, which
button is depressed when the mouse button is clicked, and related information are
also provided through method parameters. Details on these method parameter values
are provided in “IDLitManipulator::OnMouseDown” (IDL Reference Guide).
The actual processing performed by the OnMouseDown method depends entirely on
the manipulator. If the manipulator action does not rely on mouse movements, the
majority of your processing may occur in the OnMouseDown method. Regardless,
you can use this method to determine if user selections meet requirements, or to set