A SERVICE OF

logo

Chapter 15: Creating a Custom iTool Widget Interface 353
iTool Developer’s Guide Handling Callbacks
PRO example2_wdtool_callback, wBase, strID, messageIn, userdata
; Retrieve a pointer to the state structure.
wChild = WIDGET_INFO(wBase, /CHILD)
WIDGET_CONTROL, wChild, GET_UVALUE = pState
; Handle the message that was passed in.
CASE STRUPCASE(messageIn) OF
'FILENAME': BEGIN
filename = FILE_BASENAME(userdata)
newTitle = (*pState).title + ' [' + filename + ']'
WIDGET_CONTROL, wBase, TLB_SET_TITLE = newTitle
END
ELSE: ; Do nothing
ENDCASE
Your callback routine may be more complex, handling any number of messages sent
to the user interface. In practice, the callback routine for a user interface is often quite
simple — the standard user interface used by the iTools in IDL 6.2 handles only three
messages.
Note
Your callback routine is also free to quietly ignore any messages. For example, you
may choose to do nothing when the FILENAME message is received.