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