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

Last change on this file since 325 was 325, checked in by pinsard, 17 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

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