ITT Rule IDL Version 7.0 Manuel d'utilisateur Page 362

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 430
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 361
362 Chapter 15: Creating a Custom iTool Widget Interface
Example: a Custom iTool Interface iTool Developers Guide
you are not familiar with this concept, inspect the example2_wdtool routine before
reading the event handling and callback routines.
Note
We store our state variable in the user value of the first child widget, rather than the
user value of the top-level base, as a matter of programming style. You could also
choose to store the variable in the user value of the top-level base.
example2_wdtool_callback
Our example interface handles only one message from the iTool system:
FILENAME. The complete code for the callback routine is shown below.
PRO example2_wdtool_callback, wBase, strID, messageIn, userdata
; Make sure we have a valid widget.
IF (~WIDGET_INFO(wBase, /VALID)) THEN $
RETURN
; 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
; The FILENAME message is received if the user saves
; the iTool with a new name. This callback sets the
; title of the iTool to match the name of the file.
'FILENAME': BEGIN
; Use the new filename to construct the title.
; Remove the path.
filename = FILE_BASENAME(userdata)
; Append the filename onto the base title.
newTitle = (*pState).title + ' [' + filename + ']'
WIDGET_CONTROL, wBase, TLB_SET_TITLE = newTitle
END
; Other messages would be handled here.
ELSE: ; Do nothing
ENDCASE
END
Vue de la page 361
1 2 ... 357 358 359 360 361 362 363 364 365 366 367 ... 429 430

Commentaires sur ces manuels

Pas de commentaire