A SERVICE OF

logo

218 Chapter 8: Creating a Manipulator
Creating a New Manipulator iTool Developer’s Guide
scroll wheel event is processed — the magnitude of the Delta parameter (indicating
how far the wheel was scrolled) is ignored.
Creating an OnKeyboard Method
Once a manipulator has been started, and a mouse event has been registered in the
iTool window, the OnKeyboard method can support additional user interaction
through keyboard actions. The OnKeyboard event often includes execution logic
from each of the mouse methods. For example, you will likely need to verify that a
visualization has been selected (using the
nSelectionList and pSelectionList
instance data fields). If the visualization is the correct type, and the manipulator
supports undo/redo functionality, call RecordUndoValues prior to modifying the
visualization in response to keyboard actions, and call CommitUndoValues prior to
exiting the method. See “Manipulators and the Undo/Redo System” on page 202 for
details.
The parameters of the OnKeyboard method return information about whether a key
has been pressed (
Press). If an ASCII character was selected (IsASCII), access the
ASCII value (
Character). If the key was not ASCII, you can return which symbol
key was pressed (
KeyValue). The OnKeyboard method also provides access to the
window object (
oWin), and the window coordinates of the cursor (x, y). See
“IDLitManipulator::OnKeyboard” (IDL Reference Guide) for details.
Example OnKeyboard Method
The following example shows elements common to an OnKeyboard method, but not
any specific manipulation of a visualization. See “Example: Color Table
Manipulator” on page 226 for a complete example.
; Configure the OnKeyboard method.
pro ExampleManip::OnKeyboard, oWin, $
IsASCII, Character, KeyValue, X, Y, Press, Release, KeyMods
; If current event is not a key press, then return.
IF (~Press) THEN $
RETURN
; Return if no visualization was selected.
IF (self.nSelectionList EQ 0) THEN $
RETURN
; Access the first selected item and make sure it is an image.
oImage = (*self.pSelectionList)[0]
IF (OBJ_ISA(oImage,'IDLitVisImage')) THEN BEGIN
; Set the oImage field of the class structure to be