About Custom iTool Widget Interfaces
The standard interface to the iTools included with IDL is constructed from IDL widgets, using a number of special compound widgets designed to work with the iTool system. Other chapters in this section of the iTool Developer's Guide describe how to use the user interface display mechanisms of the iTool system to add functionality to your own iTools within the constraints of the standard iTool interface. This chapter describes how to create a hybrid iTool interface using both iTool compound widgets and "traditional" IDL widgets.
Before beginning the process of creating a new IDL widget-based user interface that includes iTool components, you should take the following points into consideration:
- You can use a custom iTool user interface to mix iTool components with traditional IDL widgets, but you will still be using the iTool system. This means that the custom interface you create is the interface to an iTool, not simply to a collection of widgets. You may need to create an iTool class definition for your tool, register iTool components, and handle user interface callbacks.
- The mechanisms available for interacting with iTool components such as the iTool draw window from outside the iTools framework are more limited (and in some cases more cumbersome) than those available if you write iTool framework code.
- While the standard interface to the iTools uses IDL widgets, the iTools framework and the standard iTools are designed in such a way that a non-widget iTool interface (e.g. a Java or web-based interface) could be created and the standard iTools would work seamlessly with the new interface. Custom iTool interfaces that rely on traditional IDL widgets will only function in environments that support the display of IDL widgets.
Why Create a New Widget Interface?
In most cases, you will be able to extend the iTool system to include your own functionality without modifying the standard iTool user interface. You can create and register new operations, for example, without writing any interface code at all. If your application requires extra interface elements not present in the standard interface, you can include them in a user interface panel associated with your tool. So why create a new interface using IDL widgets? The following are two possible reasons to create a custom interface:
You are updating an existing application
You may have an existing widget application that uses a traditional draw widget to display visualizations. Replacing the traditional draw widget with an iTool draw widget will require substantial revisions to your existing code, but making the revisions may be more efficient than recreating your application using only the iTool framework.
Your application has a complex interface
Your application may require a more complex user interface than is possible to implement using iTool framework methods.
What About Using a UI Panel?
Several of the standard iTools require tool-specific user interface elements. These iTools (the IIMAGE, IMAP, and IVOLUME tools) include a user interface panel that contains additional interface elements required by the tool.
If your application requires a small number of interface elements not available in the standard interface, consider creating a user interface panel rather than an entire custom user interface. Creating a user interface panel rather than a custom user interface has the following advantages:
- It is easier, and requires less interface code. You do not need to write code to handle widget resizing, for example.
- You can register your user interface panel with the iTool system, which allows the panel to appear on any iTool of the type supported by the panel. You could, for example, create a panel that would show up on the standard IIMAGE tool, along with the existing panel.
User interface panels are discussed in detail in Creating a User Interface Panel.
Skills Required to Create an iTool User Interface
To create a custom iTool user interface, you will need to be familiar with the following:
- Traditional IDL widget programming (see Creating Widget Applications (User Interface Programming)).
- Creating an iTool (see Creating an iTool).
- Creating user interface callback routines (see Creating a User Interface Panel).
- Routines and methods available for interacting with iTool components from outside the iTool framework (see Controlling iTools from the IDL Command Line).
- Use of the iTool compound widgets (see iTool Compound Widgets).
What You Will Need to Create
To build a custom iTool user interface, you will need to create a minimum of two new .pro files:
- The widget interface definition. This file creates the widget interface, defines event handlers and callbacks, takes care of widget resizing and cleanup, and registers the widgets with a user interface object.
- A launch routine. This file registers the custom interface with the iTools system and launches the iTool with the specified interface.
You may create any number of other additional files, but in most cases you will also create:
- An iTool class definition routine. This file creates an instance of the iTool that will use your custom interface. The iTool class definition may simply subclass an existing iTool class, registering new items or unregistering some of the standard items, or it may be an entirely new iTool of your creation.
Note
While you can create an iTool interface that mimics an existing application's traditional widget interface, you cannot simply add iTool compound widgets to an existing widget interface. The iTool compound widgets rely on the iTool system, and will not function on their own.