A SERVICE OF

logo

328 Chapter 14: Creating a User Interface Panel
Example: A Simple UI Panel iTool Developer’s Guide
oSel = state.oTool->GetSelectedItems()
oSel = oSel[0]
; If the last item selected is not a visualization,
; desensitize the "Hide/Show" and "Rotate" buttons.
IF (~OBJ_ISA(oSel, 'IDLITVISUALIZATION')) THEN BEGIN
WIDGET_CONTROL, state.wHide, SENSITIVE = 0
WIDGET_CONTROL, state.wRotate, SENSITIVE = 0
ENDIF ELSE BEGIN
; If the selected object is a visualization, sensitize
; the "Hide/Show" and "Rotate" buttons.
WIDGET_CONTROL, state.wHide, SENSITIVE = 1
WIDGET_CONTROL, state.wRotate, SENSITIVE = 1
ENDELSE
BREAK
END
ELSE:
ENDSWITCH
END
Discussion
The example panel’s callback routine performs the following tasks:
Uses the widget ID provided in the
wPanel argument to retrieve the widget
state structure stored in the first child widget of the panel widget.
If the value of the
messageIn argument is either SENSITIVE or
UNSENSITIVE, change the sensitivity of the Rotate button (stored in the
wRotate field of the widget state structure) as necessary.
If the value of the
messageIn argument is SELECTIONCHANGED, perform the
following tasks:
Use the reference to the iTool object stored in the
oTool field of the state
structure to retrieve a reference to the last selected component. (Note that
the last object selected is stored in the first element of the returned array.)
If the selected component is not a visualization, desensitize the
Hide/Show button.
If the selected component is a visualization, sensitize the
Hide/Show
button.
Panel Type Specification
In order to display the Example4_panel user interface panel along with an iTool, the
following two things must happen: