A SERVICE OF

logo

Chapter 15: Creating a Custom iTool Widget Interface 341
iTool Developer’s Guide Creating the Interface Routine
Error Checking
Since the successful creation of an iTool interface relies on the presence of a valid
iTool object reference, it is a good idea to check the
oTool argument before
proceeding. A statement like the following serves as a reasonable check:
IF (~OBJ_VALID(oTool)) THEN $
MESSAGE, 'Tool is not a valid object.'
Top Level Base
The first widget you will need to create when building a custom iTool widget
interface is a top-level widget base to hold the interface. Your call to the
WIDGET_BASE function should look something like:
wBase = WIDGET_BASE(/COLUMN, MBAR = wMenubar, $
TITLE = title, $
/TLB_KILL_REQUEST_EVENTS, $
/TLB_SIZE_EVENTS, $
/KBRD_FOCUS_EVENTS, $
_EXTRA = _extra)
All of the keywords shown here are documented along with the WIDGET_BASE
function, but you should note the following things:
We use the MBAR keyword to create a menubar base, which will hold both the
iTool menubars and any additional menus we choose to create. If your
interface will not have a menu bar, there is no need to specify the MBAR
keyword.
We explicitly ask for TLB_KILL_REQUEST_EVENTS. This is important
because it allows us to specify a KILL_NOTIFY procedure that will be
executed when the widget interface is destroyed.
We set the TLB_SIZE_EVENTS keyword to let the user resize the iTool
interface as described in “Handling Resize Events” on page 354.
We use the keyword inheritance mechanism (the _EXTRA keyword) to pass
any additional keyword values through to the base widget.
User Interface Object
Your widget interface must be associated with an iTool user interface object. Since
we will need the object reference to the user interface object when creating the iTool