1 | ;------------------------------------------------------------ |
---|
2 | ;------------------------------------------------------------ |
---|
3 | ;------------------------------------------------------------ |
---|
4 | ;+ |
---|
5 | ; NAME:xnotice |
---|
6 | ; |
---|
7 | ; PURPOSE:cree un widget avec du texte au milieu de la fenetre. |
---|
8 | ; |
---|
9 | ; CATEGORY:information |
---|
10 | ; |
---|
11 | ; CALLING SEQUENCE:widgetid=xnotice(text) |
---|
12 | ; |
---|
13 | ; INPUTS:text: un string ou un vecteur de string. Si c''est un |
---|
14 | ; scalaire on cherche le separateur de ligne !C pour creer un texte a |
---|
15 | ; plusieurs lignes. |
---|
16 | ; |
---|
17 | ; KEYWORD PARAMETERS:chkwidget: oblige a verifier qu''il y a des |
---|
18 | ; widgets actif pour creer un widget, sinon imprime au prompt |
---|
19 | ; |
---|
20 | ; OUTPUTS:lidentite du widget cree |
---|
21 | ; |
---|
22 | ; COMMON BLOCKS |
---|
23 | ; |
---|
24 | ; SIDE EFFECTS:ne fait pas appelle a xmanager -> ne cree aucun event! |
---|
25 | ; il faut detruire ce widget a la main: |
---|
26 | ; widget_control, widgetid, /destroy |
---|
27 | ; |
---|
28 | ; RESTRICTIONS: |
---|
29 | ; |
---|
30 | ; EXAMPLE: |
---|
31 | ; IDL> id=xnotice('ca marche !C ou pas?') |
---|
32 | ; IDL> widget_control, id, /destroy |
---|
33 | ; |
---|
34 | ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
35 | ; 2000 3 17 |
---|
36 | ;- |
---|
37 | ;------------------------------------------------------------ |
---|
38 | ;------------------------------------------------------------ |
---|
39 | ;------------------------------------------------------------ |
---|
40 | FUNCTION xnotice, text, CHKWIDGET = chkwidget |
---|
41 | ; |
---|
42 | ; on separe le text en differentes lignes (separees par !C) si ce |
---|
43 | ; n''est pas deja fait... |
---|
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 |
---|