A SERVICE OF

logo

108 Chapter 5: Creating an iTool
Example: Simple iTool iTool Developer’s Guide
Example: Simple iTool
This example creates a very simple iTool named example1tool that incorporates
standard functionality from the iTools distribution, along with other example iTool
features created in other chapters of this manual.
Example Code
The class definition code for this example iTool is included in the file
example1tool__define.pro in the examples/doc/itools subdirectory of
the IDL distribution. Run the example procedure by entering
exampletool__define at the IDL command prompt or view the file in an IDL
Editor window by entering .EDIT exampletool__define.pro.
Class Definition File
The class definition for the example1tool consists of an Init method and a class
structure definition routine. As with all object class definition files, the class structure
definition routine is the last routine in the file, and the file is given the same name as
the class definition routine (with the suffix
.pro appended).
Class Definition
PRO example1tool__Define
struct = { example1tool, $
INHERITS IDLitToolbase $ ; Provides iTool interface
}
END
Discussion
Our class definition routine is very simple. We create an IDL structure variable with
the name
example1tool, specifying that the structure inherits from the
IDLitToolbase class.
Init Method
FUNCTION example1tool::Init, _REF_EXTRA = _extra
; Call our super class
IF ( self->IDLitToolbase::Init(_EXTRA = _extra) EQ 0) THEN $
RETURN, 0