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