;+ ; ; file ACKNOWLEDGE.PRO - creates a widget that displays the input message ; then waits for a button click before allowing ; program continuation ; ;- pro acknowledge_ev, event ;+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; pro acknowledge_ev, event ; ; The event handler for PRO ACKNOWLEDGE ; calls to : none ; common : none ; ; The only purpose of the routine is to kill the message window, ; created by PRO ACKNOWLEDGE, AFTER the user reads the message. ; The user clicks the acknowledge button to get here. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;- widget_control, event.top, /destroy ; This widget is modaled so its the ; only widget the user is able to kill return & end ;=========================================================================== pro acknowledge, message=message ;+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; pro acknowledge, [message=message] ; ; Creates a message window that requires the user to acknowledge ; before control will return to the calling procedure ; ; calls to : xregistered('acknowledge'), xmanager,'acknowledge_ev' ; common : none ; ; ; INPUT ; message: string or string vector containing a message ; that will be displayed on the screen for the ; user to acknowledge. ; (multi-line messages are aesthetically better) ; OUTPUT ; none ; ; MODIFICATION HISTORY ; JAN 1993 - Elaine Einfalt (HSTX) ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;- if xregistered('acknowledge') then return ; only one at a time is allowed button_name = ' ACKNOWLEDGE ' ; word appearing in button mess_siz = n_elements(message) - 1 ; lines in message, -1 for loop if mess_siz lt 0 then begin ; no user provided message message = (['This is a programmed pause ', $ ; need to say something 'requiring you to acknowledge ', $ 'before proceding.']) mess_siz = n_elements(message) - 1 ; # times to loop below endif messwin = widget_base(title='Message window', /row, space=20, $ xpad=30, ypad=30) text_part = widget_base(messwin, /column) ; write message for i = 0, mess_siz do info = widget_label(text_part, value=message(i)) respond = widget_button(messwin, value= button_name ) widget_control, messwin, /realize ; Realize the widget xmanager,'acknowledge', messwin, event_handler='acknowledge_ev', /modal return & end