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 ITREGISTER procedure. In most cases, the call to the ITREGISTER 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.
Use the ITREGISTER routine to register the class definition:
ITREGISTER, 'Tool Name', 'Tool_Class_Name'
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.
__define.promust 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 ITREGISTER 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 ITREGISTER for details.
Suppose you have an iTool class definition file named
myTool__define.pro, located in a directory included in IDL's
ITREGISTER, 'My First Tool', 'myTool'
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.