user manual

324 Chapter 14: Creating a User Interface Panel
Example: A Simple UI Panel iTool Developer’s Guide
oUI->AddOnNotifyObserver, strObserverIdentifier, idRotate
ENDIF ELSE $
idRotate = 0
wHide = WIDGET_BUTTON(wBase, VALUE = "Show/Hide Item", $
UVALUE = "HIDE")
; Pack up the state structure and store in first child.
state = {oTool:oTool, $
oUI:oUI, $
idRotate : idRotate, $
wPanel:wPanel, $
wBase:wBase, $
wRotate:wRotate, $
wHide:wHide $
}
wChild = WIDGET_INFO(wPanel, /CHILD)
IF wChild NE 0 THEN $
WIDGET_CONTROL, wChild, SET_UVALUE = state, /NO_COPY
END
Discussion
It is beyond the scope of this chapter to describe the IDL widget concepts employed
in the Example4_panel example; the comments in the code that creates the user
interface panel describe most of the features. The following points are worth noting,
however:
The panel creation routine accepts two arguments: the widget ID of the panel
widget (stored in the variable
wPanel, in this example), and an object
reference to the IDLitUI object associated with the iTool (stored in the variable
oUI).
The example uses the EVENT_PRO keyword to the WIDGET_CONTROL
procedure to establish an event-handling routine,
Example4_panel_event.
This event-handling routine is described in “Panel Event Handler Routine” on
page 325.
The example registers a single callback routine,
Example4_panel_callback, using the RegisterWidget method of the
IDLitUI class. The callback routine is described in “Panel Callback Routine”
on page 327.
The example adds an OnNotifyObserver for the
Visualization component
described in Adding Observers” on page 315.