1 | ;+ |
---|
2 | ; |
---|
3 | ; @file_comments |
---|
4 | ; Create a widget with some text at the middle of the window |
---|
5 | ; |
---|
6 | ; @categories |
---|
7 | ; Information |
---|
8 | ; |
---|
9 | ; @param TEXT {in}{required}{type=string vector or scalar} |
---|
10 | ; it is a string or a vector of string. If it is a scalar, we |
---|
11 | ; look for the line separator !C to create a text with several lines. |
---|
12 | ; |
---|
13 | ; @keyword CHKWIDGET |
---|
14 | ; Force to verify that they are some active widget to create a widget, |
---|
15 | ; otherwise print at the prompt |
---|
16 | ; |
---|
17 | ; @returns |
---|
18 | ; The identity of the created widget |
---|
19 | ; |
---|
20 | ; @restrictions |
---|
21 | ; It do not call xmanager -> It do not create any event! |
---|
22 | ; We have to delete this widget manually: |
---|
23 | ; widget_control, widgetid, /destroy |
---|
24 | ; |
---|
25 | ; @examples |
---|
26 | ; IDL> id=xnotice('ca marche !C ou pas?') |
---|
27 | ; IDL> widget_control, id, /destroy |
---|
28 | ; |
---|
29 | ; @history |
---|
30 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
31 | ; 2000 3 17 |
---|
32 | ; |
---|
33 | ; @version |
---|
34 | ; $Id$ |
---|
35 | ; |
---|
36 | ;- |
---|
37 | ; |
---|
38 | FUNCTION xnotice, text, CHKWIDGET = chkwidget |
---|
39 | ; |
---|
40 | ; We separate the text in different lines (separated by !C) if it is not done yet... |
---|
41 | ; |
---|
42 | compile_opt idl2, strictarrsubs |
---|
43 | ; |
---|
44 | if n_elements(text) EQ 1 then text = str_sep(text, '!C', /trim) |
---|
45 | ; |
---|
46 | if keyword_set(chkwidget) then makewid = (widget_info(/managed))[0]ELSE makewid = 1 |
---|
47 | ; |
---|
48 | if makewid EQ 0 then BEGIN |
---|
49 | for i = 0, n_elements(text)-1 do print, text[i] |
---|
50 | noticebase = 0 |
---|
51 | endif |
---|
52 | ; |
---|
53 | noticebase = widget_base(/column, title = 'information', /align_center) |
---|
54 | screensize = get_screen_size() |
---|
55 | widget_control, noticebase, tlb_set_xoffset = screensize[0]/2.2, tlb_set_yoffset = screensize[1]/2.2 |
---|
56 | nothing = widget_label(noticebase, value = ' ') |
---|
57 | for i = 0, n_elements(text)-1 do nothing = widget_label(noticebase, value = text[i]) |
---|
58 | nothing = widget_label(noticebase, value = ' ') |
---|
59 | widget_control,noticebase,/realize |
---|
60 | ; |
---|
61 | return, noticebase |
---|
62 | end |
---|