;+
; smei_query
;	Get a Yes/No answer to a question
;
; Usage:
;	ireply = smei_query(message)
;
; Arguments:
; 	message	string	The message to be displayed.
;
; Keywords:
;	dialog_parent	long	Optional "parent" for the dialogue.
;
; Other keys used by dialog_message can also be passed (they will of
; course be ignored if no pop-up is generated).
; 
; History:
;	original: 20/12/99; SJT
;	Support dialog_message keywords: 22/2/01; SJT
;-

function Smei_query, message, dialog_parent = dialog_parent, _extra = $
                   _extra

if (widget_info(/active)) then begin  
    reply = dialog_message(/question, message, dialog_parent = $
                           dialog_parent, _extra = _extra)
    return, reply eq 'Yes'
endif else begin
    print, message, format = "(A)"
Get_reply:    
    reply = ''
    read, "Answer Y or N :_", reply
    if (strupcase(reply) eq 'Y') then return, 1 $
    else if (strupcase(reply) eq 'N') then return, 0 $
    else begin
        print, 'Please answer Y or N'
        goto, get_reply
    endelse
endelse

end
