user manual
Chapter 8: Creating a Manipulator 209
iTool Developer’s Guide Creating a New Manipulator
whether keywords not explicitly handled by your method will be passed through to
other routines called by your method via IDL’s keyword inheritance mechanism.
Note
Because iTool manipulators are invoked by the user’s interactive choice of a toolbar
item, they generally do not accept any keywords of their own.
The function signature of an Init method for a manipulator generally looks something
like this:
FUNCTION
MyManipulator
::Init, _REF_EXTRA = _extra
where MyManipulator is the name of your manipulator class.
Note
Always use keyword inheritance (the _REF_EXTRA keyword) to pass keyword
parameters through to any called routines. See “Keyword Inheritance” (Chapter 5,
Application Programming) for details on IDL’s keyword inheritance mechanism.
Superclass Initialization
The manipulator class Init method should call the Init method of any required
superclass. For example, if your manipulator class is based on an existing
manipulator, you would call that manipulator’s Init method:
success = self->
SomeManipulatorClass
::Init(_EXTRA = _extra)
where SomeManipulatorClass is the class definition file for the manipulator on which
your new manipulator is based. The variable
success contains a 1 if the
initialization was successful.
Note
Your manipulator class may have multiple superclasses. In general, each
superclass’ Init method should be invoked by your class’ Init method.
Error Checking
Rather than simply calling the superclass Init method, it is a good idea to check
whether the call to the superclass Init method succeeded. The following statement
checks the value returned by the superclass Init method. If the returned value is 0
(indicating failure), the current Init method also immediately returns with a value
of 0:
IF ( self->
SomeManipulatorClass
::Init(_EXTRA = _extra) EQ 0) THEN
$