Registering a New Tool Class
Before an instance of a new iTool can be created, the tool's class definition must be registered with the iTool system. Registering an iTool class with the system links the class definition file containing the actual IDL code that initializes an iTool object with a simple string that names the iTool. Since you use the name string in code that creates instances of individual tools, a change to the name of the class definition file requires only a change to the code that registers the iTool class.
iTool classes are registered using the IREGISTER procedure. In most cases, the call to the IREGISTER procedure will be included in an iTool's launch routine, but the call can take place in any code at any time. If multiple iTool launch routines create instances of the same iTool class, however, you may find it more convenient to register the iTool in a single routine, called only once. This removes the need to call the registration routine in each launch routine individually.
Note
If only a small number of routines will create instances of a given iTool, you may find it more convenient to register the iTool class within the tool launch routine.
Using IREGISTER
Use the IREGISTER routine to register the class definition:
where Tool Name is a string you will use to create instances of the tool, and Tool_Class_Name is a string that specifies the name of the class file that contains the tool's definition.
Note
The file Tool_Class_Name__define.pro must exist somewhere in IDL's path for the tool definition to be successfully registered.
If a given iTool class has already been registered when the IREGISTER routine is called, the class will not be registered a second time. The registration can be performed at any time in an IDL session before you attempt to create an instance of the iTool.
See "IREGISTER" (IDL Reference Guide) for details.
Example
Suppose you have an iTool class definition file named myTool__define.pro, located in a directory included in IDL's !PATH system variable. Register this class with the iTool system with the following command:
Tools defined by the myTool class definition file can now be created by the iTool system by specifying the tool name My First Tool. In most cases, this command would be included in the launch routine for the myTool iTool, but the call can be placed in any code that is executed before the first instance of the iTool is created.