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

Last change on this file since 495 was 495, checked in by pinsard, 10 years ago

fix thanks to coding rules; typo; dupe empty lines; trailing blanks

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
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;
27;   IDL> id=xnotice('ca marche !C ou pas?')
28;   IDL> widget_control, id, /destroy
29;
30; @history
31; Sebastien Masson (smasson\@lodyc.jussieu.fr)
32;                      2000 3 17
33;
34; @version
35; $Id$
36;
37;-
38FUNCTION 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@cm_general
45;
46  IF NOT keyword_set(key_batch) THEN BEGIN
47
48    if n_elements(text) EQ 1 then text = str_sep(text, '!C', /trim)
49;
50    if keyword_set(chkwidget) then makewid = (widget_info(/managed))[0] ELSE makewid = 1
51;
52    if makewid EQ 0 then BEGIN
53      for i = 0,  n_elements(text)-1 do print, text[i]
54      noticebase = 0
55    endif
56;
57    noticebase = widget_base(/column, title = 'information', /align_center)
58    screensize = get_screen_size()
59    widget_control, noticebase, tlb_set_xoffset = screensize[0]/2.2, tlb_set_yoffset = screensize[1]/2.2
60    nothing = widget_label(noticebase, value = ' ')
61    for i = 0,  n_elements(text)-1 do nothing = widget_label(noticebase, value = text[i])
62    nothing = widget_label(noticebase, value = ' ')
63    widget_control, noticebase, /realize
64;
65  ENDIF ELSE noticebase = -1
66
67  return, noticebase
68end
Note: See TracBrowser for help on using the repository browser.