A SERVICE OF

logo

Chapter 14: Creating a User Interface Panel 327
iTool Developer’s Guide Example: A Simple UI Panel
Use the DoSetProperty method of the IDLitTool object to toggle the value
of the HIDE property for the selected item.
Commit the property change in the undo/redo transaction buffer using the
CommitActions method of the IDLitTool object.
After the iTool display has been changed, call the RefreshCurrentWindow
method of the IDLitTool object to redraw the iTool window.
Panel Callback Routine
The user interface panel callback routine is called whenever a component, for which
an OnNotifyObserver has been registered, generates a message. It parses the message
received and takes action as necessary.
PRO Example4_panel_callback, wPanel, strID, messageIn, component
; Make sure we have a valid widget ID.
IF ~ WIDGET_INFO(wPanel, /VALID) THEN RETURN
; Retrieve the widget ID of the first child widget of
; the UI panel.
wChild = WIDGET_INFO(wPanel, /CHILD)
; Retrieve the state structure from the user value of
; the first child widget.
WIDGET_CONTROL, wChild, GET_UVALUE = state
; Process as necessary, depending on the message received.
SWITCH STRUPCASE(messageIn) OF
; This section handles messages generated when the rotate
; operation becomes available or unavailable, and sensitizes
; or desensitizes the "Rotate" button accordingly.
'SENSITIVE':
'UNSENSITIVE': BEGIN
WIDGET_CONTROL, state.wRotate, $
SENSITIVE = (messageIn EQ 'SENSITIVE')
BREAK
END
; This section handles messages generated when the
; item selected in the iTool window changes and changes
; the sensitivity of the "Hide/Show" and "Rotate" buttons
; accordingly.
'SELECTIONCHANGED': BEGIN
; Retrieve the item that was selected last, which is
; stored in the first element of the returned array.