Once you have created your custom iTool widget interface, you must create a way to launch an iTool using the interface. To do this, you will most often create a custom iTool launch routine.
iTool launch routines are discussed in detail in Creating an iTool Launch Routine. This section describes changes you will need to make to an existing launch routine to cause an iTool to use your custom widget interface.
To register your new user interface, call the ITREGISTER routine with the USER_INTERFACE keyword. The following statement registers the example interface developed in Example: a Custom iTool Interface:
ITREGISTER, 'Example2_UI', 'example2_wdtool', /USER_INTERFACE
Here, the example interface is registered with the name "Example2_UI".
The final step is to create an instance of an iTool using your interface. To do this, specify the USER_INTERFACE keyword to the IDLITSYS_CREATETOOL function. The following statement creates an instance of an example tool using the example interface:
identifier = IDLITSYS_CREATETOOL('Example 2 Tool',$ VISUALIZATION_TYPE = ['Plot'], $ USER_INTERFACE='Example2_UI', $ TITLE = 'Example iTool Interface', $ _EXTRA = _extra)
See the iTool launch routine developed in Example: a Custom iTool Interface for a working example.
If you first register your iTool interface with the iTool system using the ITREGISTER procedure, you can specify that your interface be used by an existing iTool launch routine that accepts the USER_INTERFACE keyword. This allows you to avoid the need to create a custom launch routine if an existing routine will serve.
For example, if we wanted to use our custom interface with the IPLOT tool, we could execute the following lines a the IDL command prompt:
ITREGISTER, 'Example2_UI', 'example2_wdtool', /USER_INTERFACE IPLOT, USER_INTERFACE='Example2_UI'
These lines will create an iPlot tool using our custom user interface.
This approach may be worthwhile when an existing launch routine handles data specified on the command line in a way that suits your needs. For example, while our example tool accepts no parameters at the IDL command prompt, specifying our custom interface as the interface for the iPlot tool allows us to specify data:
IPLOT, EXP(INDGEN(10)), USER_INTERFACE='Example2_UI'