;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; NAME:xnotice ; ; PURPOSE:cree un widget avec du texte au milieu de la fenetre. ; ; CATEGORY:information ; ; CALLING SEQUENCE:widgetid=xnotice(text) ; ; INPUTS:text: un string ou un vecteur de string. Si c''est un ; scalaire on cherche le separateur de ligne !C pour creer un texte a ; plusieurs lignes. ; ; KEYWORD PARAMETERS:chkwidget: oblige a verifier qu''il y a des ; widgets actif pour creer un widget, sinon imprime au prompt ; ; OUTPUTS:lidentite du widget cree ; ; COMMON BLOCKS ; ; SIDE EFFECTS:ne fait pas appelle a xmanager -> ne cree aucun event! ; il faut detruire ce widget a la main: ; widget_control, widgetid, /destroy ; ; RESTRICTIONS: ; ; EXAMPLE: ; IDL> id=xnotice('ca marche !C ou pas?') ; IDL> widget_control, id, /destroy ; ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) ; 2000 3 17 ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ FUNCTION xnotice, text, CHKWIDGET = chkwidget ; ; on separe le text en differentes lignes (separees par !C) si ce ; n''est pas deja fait... if n_elements(text) EQ 1 then text = str_sep(text, '!C', /trim) ; if keyword_set(chkwidget) then makewid = (widget_info(/managed))[0]ELSE makewid = 1 ; if makewid EQ 0 then BEGIN for i = 0, n_elements(text)-1 do print, text[i] noticebase = 0 endif ; noticebase = widget_base(/column, title = 'information', /align_center) screensize = get_screen_size() widget_control, noticebase, tlb_set_xoffset = screensize[0]/2.2, tlb_set_yoffset = screensize[1]/2.2 nothing = widget_label(noticebase, value = ' ') for i = 0, n_elements(text)-1 do nothing = widget_label(noticebase, value = text[i]) nothing = widget_label(noticebase, value = ' ') widget_control,noticebase,/realize ; return, noticebase end