[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 | ;- |
---|
[231] | 37 | ; |
---|
[2] | 38 | FUNCTION xnotice, text, CHKWIDGET = chkwidget |
---|
| 39 | ; |
---|
[150] | 40 | ; We separate the text in different lines (separated by !C) if it is not done yet... |
---|
[2] | 41 | ; n''est pas deja fait... |
---|
[114] | 42 | ; |
---|
| 43 | compile_opt idl2, strictarrsubs |
---|
| 44 | ; |
---|
[2] | 45 | if n_elements(text) EQ 1 then text = str_sep(text, '!C', /trim) |
---|
| 46 | ; |
---|
| 47 | if keyword_set(chkwidget) then makewid = (widget_info(/managed))[0]ELSE makewid = 1 |
---|
| 48 | ; |
---|
| 49 | if makewid EQ 0 then BEGIN |
---|
| 50 | for i = 0, n_elements(text)-1 do print, text[i] |
---|
| 51 | noticebase = 0 |
---|
| 52 | endif |
---|
| 53 | ; |
---|
| 54 | noticebase = widget_base(/column, title = 'information', /align_center) |
---|
| 55 | screensize = get_screen_size() |
---|
| 56 | widget_control, noticebase, tlb_set_xoffset = screensize[0]/2.2, tlb_set_yoffset = screensize[1]/2.2 |
---|
| 57 | nothing = widget_label(noticebase, value = ' ') |
---|
| 58 | for i = 0, n_elements(text)-1 do nothing = widget_label(noticebase, value = text[i]) |
---|
| 59 | nothing = widget_label(noticebase, value = ' ') |
---|
| 60 | widget_control,noticebase,/realize |
---|
| 61 | ; |
---|
| 62 | return, noticebase |
---|
| 63 | end |
---|