; -------------------------------------------------------------------------- ; PROCEDURE NON_MODAL_DIALOG_EVENT ; -------------------------------------------------------------------------- ; PURPOSE: ; PRO non_modal_dialog_event, event WIDGET_CONTROL, event.handler, /DESTROY END ; -------------------------------------------------------------------------- ; PROCEDURE NON_MODAL_DIALOG ; -------------------------------------------------------------------------- ; PURPOSE: ; This creates a small non-modal dialog box that holds the text passed in ; by the 'input' parameter. An 'OK' button located at the button closes ; the dialog box. ; ; PARAMETERS: ; 'input' - ; A string or array of strings to be printed out on the dialog box. ; PRO non_modal_dialog, input, TITLE=_TITLE if ~KEYWORD_SET(_TITLE) then _TITLE='Information' ; Go through each of the input cells finding the width for the dialog box no_show = widget_base(TITLE='You should not see this') const_width = 50 for i=0, n_elements(input)-1 do begin label = widget_label(no_show, value=input[i]) width = (WIDGET_INFO(label, /geom, units=0)).xsize if width gt const_width then const_width = width endfor ; Create the dialog box dialog_base = widget_base(TITLE=_TITLE, /COLUMN, $ /BASE_ALIGN_CENTER, xsize=const_width+60) label_base = widget_base(dialog_base, xsize=const_width, $ /BASE_ALIGN_LEFT, /COLUMN) for i=0, n_elements(input)-1 do $ void = widget_label(label_base, value=input[i]) line = widget_base(dialog_base, xsize=const_width+56, ysize=1, /FRAME) ok_btn = widget_button(dialog_base, value='OK', xsize=50) ; Realize the dialog box and start the event handler WIDGET_CONTROL, dialog_base, /REALIZE XMANAGER, 'non_modal_dialog', dialog_base, /NO_BLOCK END