user manual
204 Chapter 8: Creating a Manipulator
Using Manipulator Public Instance Data iTool Developer’s Guide
Using Manipulator Public Instance Data
The IDLitManipulator class automatically manages selection state between mouse-
down and mouse-up interactions. Three public instance fields are exposed, providing
information about the mouse button state (
ButtonPress), the number of selected
items (
nSelectionList), and an array of the currently selected visualizations
(
pSelectionList).
Note
These fields are set by the OnMouseDown method of IDLitManipulator, which
would be called by the OnMouseDown method of the subclass. These fields are
therefore available after a mouse down event in the iTool window.
Using the ButtonPress Field
The ButtonPress field holds the state of mouse buttons when a manipulator has
been activated. For example, suppose your manipulator requires the user to hold
down a mouse button while moving the mouse cursor to affect some aspect of the
visualization. You could use a pointer, set in the mouse down event and not reset
until the mouse up event, to indicate the user is holding down the mouse button.
However, a more efficient way is to use the built-in
ButtonPress field to access the
same information. The
ButtonPress field is a bitmask with the following possible
values:
• 0 = No mouse button is pressed
• 1 = The left mouse button is pressed
• 2 = The middle mouse button is pressed
• 4 = The right mouse button is pressed
To determine if the user is holding down a mouse button, query the
ButtonPress
field in the OnMouseMotion method. Prior to manipulating a visualization, a
statement such as the following would assure a mouse button was pressed:
; Activate if mouse button is held down.
IF self.ButtonPress NE 0 THEN BEGIN
You could modify this statement to determine which mouse button is pressed or
access the field in one of the other mouse transaction methods. See “Creating Mouse
Event Methods” on page 213 for more information about the OnMouseDown,
OnMouseMotion and OnMouseUp methods.