user manual
Chapter 14: Creating a User Interface Panel 329
iTool Developer’s Guide Example: A Simple UI Panel
1. The UI panel must be registered, using the ITREGISTER procedure.
2. A tool with the appropriate TYPE must be created.
For the purposes of this example, we will create an iTool named
example4tool,
with a launch routine named
example4tool.pro, and an iTool object definition
routine named
example4tool__define.pro.
Example Code
Both
example4tool.pro, and example4tool__define.pro are included in
the
examples/doc/itools subdirectory of the IDL distribution. Run these
example procedures by entering
example4tool or example4tool__define at
the IDL command prompt or view the files in an IDL Editor window by entering
.EDIT example4tool.pro or .EDIT example4tool__define.pro.
In the
example4tool.pro file, we included the following statement:
ITREGISTER, 'Example Panel', 'Example4_panel', TYPE = 'EXAMPLE', $
/UI_PANEL
Setting the TYPE keyword equal to the string EXAMPLE specifies that the panel
should be displayed for all iTools of this type.
In the
example4tool__define.pro file, we include the string EXAMPLE in the
TYPE property specified in the Init method:
FUNCTION example4tool::Init, _REF_EXTRA = _extra
IF (self->IDLitToolbase::Init(_EXTRA = _extra, $
TYPE = 'EXAMPLE') EQ 0) $
THEN RETURN, 0
Since the TYPE specified for the user interface panel in the call to ITREGISTER
matches the TYPE defined for our example iTool class, calling the launch routine
example4tool at the IDL Command Line creates a new iTool and displays the
Example4_panel panel on the right side of the iTool window.