Registering a UI Service
Before a user interface service can be called from an iTool, the routine that implements the service must be registered with the iTool system. Registering a UI service with the system links the file containing the actual IDL code that creates the user interface elements with a simple string that names the UI service. Since you use the name string in code that calls the service, the iTool itself does not need to know anything about the display environment in which it is running.
User interface services are registered either using the IREGISTER procedure or via a call to the RegisterUIService method of the IDLitUI object. In most cases, registration is accomplished via a call to the IREGISTER procedure in an iTool's launch routine. A UI service can be registered at any time. In practice, you will probably find it convenient to register UI services used by an iTool in the iTool launch routine, unless you know the service has already been registered. For a list of UI services that are pre-registered by the standard iTools, see Predefined iTool UI Services.
Using IREGISTER
Use the IREGISTER routine to register a user interface service:
where UI Service Name is a string you will use to call the user interface service, and UI_Service_Routine is a string that specifies the name of the file that contains the code for the user interface service.
Note
The file UI_Service_Routine.pro must exist somewhere in IDL's path for the service definition to be successfully registered.
If a given user interface service has already been registered when the IREGISTER routine is called, the service will not be registered a second time. The registration can be performed at any time in an IDL session before you attempt to call the user interface service.
See "IREGISTER" (IDL Reference Guide) for details.
Example
Suppose you have a UI service definition file named myUIService.pro, located in a directory included in IDL's !PATH system variable. Register this service with the iTool system with the following command:
The user interface service can now be invoked via the DoUIService method:
where oTool is an object reference to the current iTool object.
Using the RegisterUIService Method
User interface services can also be registered by a call to the RegisterUIService method of the IDLitUI object:
self->RegisterUIService, 'My UI Service', 'myUIService'Note
In most cases, you do not have a reference to the IDLitUI object available, so this method is not generally useful. We mention it here because the user interface services registered for use by the standard iTools are registered in this way, rather than via the IREGISTER procedure.