;+ ; ; @file_comments ; Create a widget with some text at the middle of the window ; ; @categories ; Information ; ; @param TEXT {in}{required}{type=string vector or scalar} ; it is a string or a vector of string. If it is a scalar, we ; look for the line separator !C to create a text with several lines. ; ; @keyword CHKWIDGET ; Force to verify that they are some active widget to create a widget, ; otherwise print at the prompt ; ; @returns ; The identity of the created widget ; ; @restrictions ; It do not call xmanager -> It do not create any event! ; We have to delete this widget manually: ; widget_control, widgetid, /destroy ; ; @examples ; IDL> id=xnotice('ca marche !C ou pas?') ; IDL> widget_control, id, /destroy ; ; @history ; Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 2000 3 17 ; ; @version ; $Id$ ; ;- FUNCTION xnotice, text, CHKWIDGET = chkwidget ; ; We separate the text in different lines (separated by !C) if it is not done yet... ; compile_opt idl2, strictarrsubs ; 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