A SERVICE OF

logo

Chapter 15: Creating a Custom iTool Widget Interface 371
iTool Developer’s Guide Example: a Custom iTool Interface
END
Discussion
This routine uses the same technique as the draw_plot_event routine to ensure that
our iTool is the current tool. It then retrieves the identifier of the plot line and the
Median operation, selects the line, calls the DoAction method to apply the Median
filter to the selected plot line. For additional information on retrieving component
identifiers and executing operations, see Appendix A, “Controlling iTools from the
IDL Command Line”.
example2_wdtool
The example2_wdtool routine builds the widget hierarchy for our custom iTool
interface and registers it with the iTool system. Much of this routine consists of
standard IDL widget programming, and many of the sections have been discussed in
“Creating the Interface Routine” on page 340. The complete code for the widget
creation routine is shown below.
PRO example2_wdtool, oTool, TITLE = titleIn, $
LOCATION = location, $
VIRTUAL_DIMENSIONS = virtualDimensions, $
USER_INTERFACE = oUI, $ ; output keyword
_REF_EXTRA = _extra
; Make sure the iTool object reference we've been passed
; is valid.
IF (~OBJ_VALID(oTool)) THEN $
MESSAGE, 'Tool is not a valid object.'
; Set the window title.
title = (N_ELEMENTS(titleIn) GT 0) ? titleIn[0] : 'IDL iTool'
; Display the hourglass cursor while the iTool is loading.
WIDGET_CONTROL, /HOURGLASS
; Create a base widget to hold everything.
wBase = WIDGET_BASE(/COLUMN, MBAR = wMenubar, $
TITLE = title, $
/TLB_KILL_REQUEST_EVENTS, $
/TLB_SIZE_EVENTS, $
/KBRD_FOCUS_EVENTS, $
_EXTRA = _extra)
; Create a new user interface object, using our iTool.
oUI = OBJ_NEW('IDLitUI', oTool, GROUP_LEADER = wBase)
; Menubars: