source: trunk/SRC/ToBeReviewed/WIDGET/xnotice.pro @ 134

Last change on this file since 134 was 134, checked in by navarro, 18 years ago

change *.pro file properties (del eof-style, del executable, set keywords Id

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
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;------------------------------------------------------------
40FUNCTION 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;
45  compile_opt idl2, strictarrsubs
46;
47   if n_elements(text) EQ 1 then text = str_sep(text, '!C', /trim)
48;
49   if keyword_set(chkwidget) then makewid = (widget_info(/managed))[0]ELSE makewid = 1
50;
51   if makewid EQ 0 then BEGIN
52      for i = 0,  n_elements(text)-1 do print, text[i]
53      noticebase = 0
54   endif
55;
56   noticebase = widget_base(/column, title = 'information', /align_center)
57   screensize = get_screen_size()
58   widget_control, noticebase, tlb_set_xoffset = screensize[0]/2.2, tlb_set_yoffset = screensize[1]/2.2
59   nothing = widget_label(noticebase, value = ' ')
60   for i = 0,  n_elements(text)-1 do nothing = widget_label(noticebase, value = text[i])
61   nothing = widget_label(noticebase, value = ' ')
62   widget_control,noticebase,/realize
63;
64   return, noticebase
65end
Note: See TracBrowser for help on using the repository browser.