pro xquestion_c_u,a

Common Exch_xquestion,group,Value

if group ne 0 then if widget_info(group,/valid) then $
	widget_control,group,/show

end


pro xquestion_event,ev,a

Common Exch_xquestion,group,Value

WIDGET_CONTROL,ev.id,GET_UVALUE = uv

CASE uv OF

"Yes":	Value=0
"No":	Value=1

ENDCASE
WIDGET_CONTROL,ev.top,/DESTROY
end

;*************************************

pro xquestion,a, group_leader=group_leader, prompt=prompt, $
xsize=xsize,ysize=ysize,xpos=xpos, ypos=ypos, $
selection=selection, text=text, exclusive=exclusive, $
	nonexclusive=nonexclusive

;	Interactive selection of two possibilities.

Common Exch_xquestion,group,Value

device,get_scr=scr

if n_elements(group_leader) le 0 then group_leader=0L
group=group_leader
if n_elements(xpos) le 0 then xpos=scr(0)/3
if n_elements(ypos) le 0 then ypos=scr(1)/3
if n_elements(xsize) le 0 then xsize=scr(0)/2.5
if n_elements(text) le 0 then text=' '
if n_elements(prompt) le 0 then prompt=' '
if n_elements(selection) le 0 then selection=['Yes','No']
if n_elements(exclusive) le 0 then exclusive=0
if n_elements(nonexclusive) le 0 then nonexclusive=0


margin=string(' ',format="(a1,5(' '))")

base=widget_base(/colu,xoff=xpos,yoff=ypos, $
	tit=prompt,group=group_leader, $
     space=scr(1)/40,ypad=scr(1)/40) ;,xsiz=scr(0)/2.5,ysiz=scr(1)/3)

length=2*strlen(margin)+max(strlen(text(*)))

Ques=widget_text(base,ysiz=n_elements(text) > 1, $
	val=margin+text,xsiz=length)

base1=widget_base(base,/row, xpad=scr(0)/12, $
     space=scr(0)/40,ypad=scr(1)/40,tit=prompt, $
	group=group_leader, nonexclusive=nonexclusive, $
	exclusive=exclusive)

But0 = WIDGET_BUTTON(base1,Uval='Yes',val=selection(0))

But1 = WIDGET_BUTTON(base1,Uval='No',val=selection(1))


WIDGET_CONTROL,base,/realize,/hourglass
WIDGET_CONTROL,But0,/input_focus

xmanager,'xquestion',base,modal=1,cleanup='xquestion_c_u'

a=selection(Value)

end