A SERVICE OF

logo

314 Chapter 14: Creating a User Interface Panel
Creating a UI Panel Interface iTool Developer’s Guide
Use the widget ID of the panel widget to set the title of the tab that appears at the top
of the panel. For example the following lines might occur at the beginning of a
routine that builds a user interface panel:
PRO ExamplePanel, wPanel, oUI
; Set the title used on the panel's tab.
WIDGET_CONTROL, wPanel, BASE_SET_TITLE='Example Panel'
...
more panel code
.
The wPanel argument contains the widget ID of the panel widget, which was
assigned when the iTool interface was built. The
oUI argument contains an object
reference to the IDLitUI object associated with the current iTool. The call to the
WIDGET_CONTROL procedure sets the title of the tab to be “Example Panel.”
You may also find it useful to specify a single event-handling routine for all events
generated by the panel widget. You can specify the name of this routine with a
statement similar to the following:
WIDGET_CONTROL, wPanel, EVENT_PRO = 'ExamplePanel_event'
where ExamplePanel_event is replaced by the name of the event-handling routine
you create for your panel. Of course, you can also specify event-handling routines for
specific widgets within the panel using the EVENT_PRO and EVENT_FUNC
keywords to the widget creation routines.
Registering the Panel with the User Interface Object
To ensure that notifications from the iTool itself are passed to the user interface panel
as needed, the panel creation routine must register the panel widget with the iTool
user interface object. This registration step allows you to specify the name of the
callback routine that will be called when a notification is generated by the iTool
itself.
To register a user interface panel, use the RegisterWidget method of the IDLitUI
object:
idObserver = oUI->RegisterWidget(wPanel, 'Panel', 'Ex_callback')
where oUI is an object reference to the IDLitUI object and wPanel is the widget ID
of the panel widget; both are passed in as arguments to the panel creation routine. The
second argument to the RegisterWidget method (
'Panel', in this example) is the
human-readable name of the UI panel. The third argument (
'Ex_callback', in this
example) is the name of the panel’s callback routine. See “IDLitUI::RegisterWidget”
(IDL Reference Guide) for details. Callback routines are discussed in detail in
“Creating Callback Routines” on page 318.