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

Last change on this file 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
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;
[371]27;   IDL> id=xnotice('ca marche !C ou pas?')
28;   IDL> widget_control, id, /destroy
29;
[150]30; @history
[157]31; Sebastien Masson (smasson\@lodyc.jussieu.fr)
[2]32;                      2000 3 17
[150]33;
34; @version
35; $Id$
36;
[2]37;-
[486]38FUNCTION xnotice, text, CHKWIDGET = chkwidget
[2]39;
[150]40; We separate the text in different lines (separated by !C) if it is not done yet...
[114]41;
42  compile_opt idl2, strictarrsubs
43;
[486]44@cm_general
[2]45;
[486]46  IF NOT keyword_set(key_batch) THEN BEGIN
47
48    if n_elements(text) EQ 1 then text = str_sep(text, '!C', /trim)
[2]49;
[486]50    if keyword_set(chkwidget) then makewid = (widget_info(/managed))[0] ELSE makewid = 1
51;
52    if makewid EQ 0 then BEGIN
[2]53      for i = 0,  n_elements(text)-1 do print, text[i]
54      noticebase = 0
[486]55    endif
[2]56;
[486]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
[2]64;
[486]65  ENDIF ELSE noticebase = -1
66
67  return, noticebase
[2]68end
Note: See TracBrowser for help on using the repository browser.