; returns LEGAL gt 0 if user input valid parameter value 

function widget_input_ran, input=input, group=group, str=str, out=out, $
		  current=current, cat_widg=cat_widg, nofull=nofull

common user_s_input, new_param, apply
common passers, yield, inhib, notfull


 new_param = ''		; will be replaced with the user's new parameter value

 ;
 ; Create the widget showing current values and letting user input 
 ; new values
 ;

 if cat_widg.group eq '' then begin xoff = 20 & yoff=50   ; second level widg
 endif else begin xoff = 30 & yoff=75 			  ; third level widget
 endelse		  

 mini_base = widget_base(title='UVSP Catalog parameter input', /column, $
			 xoffset=xoff, yoffset=yoff, xpad=30, ypad=30, space=25)

  user_put = widget_base(mini_base, /row)   
     lab = widget_label(user_put, value='Enter new '+input+' and RETURN: ')
     in_text = widget_text(user_put, /scroll, ysize=1, xsize=60, /editable, $
			   	     uvalue='USER_INPUT')

  info = widget_base(mini_base, /row)
     lab = widget_label(info, value='Current parameter for '+input+' :')
     cur_text = widget_text(info, /scroll, ysize=1, xsize=60, value=current)

  quicklook = widget_base(mini_base, /row, space=10)
     lab = widget_label(quicklook, value='Quick pick buttons :')
     wld  = widget_button(quicklook, value='Working WLD', uvalue='!WLD')
     yr80 = widget_button(quicklook, value='1980', uvalue='!80')
     yr84 = widget_button(quicklook, value='1984', uvalue='!84')
     yr85 = widget_button(quicklook, value='1985', uvalue='!85')
     yr86 = widget_button(quicklook, value='1986', uvalue='!86')
     yr87 = widget_button(quicklook, value='1987', uvalue='!87')
     yr88 = widget_button(quicklook, value='1988', uvalue='!88')
     yr89 = widget_button(quicklook, value='1989', uvalue='!89')
     aero = widget_button(quicklook, value='AERONOMY', uvalue='!AERO')


  message = ''
  UVSP_CATHELP, input=input, message=message

  help_win = widget_text(mini_base, xsize=72, ysize=10, /scroll, value=message)


  cancel= widget_button(mini_base, value='CANCEL :  Preserves current ' + $
			'parameter value shown above', uvalue='CANCEL')
  apply = widget_button(mini_base, value='READY :  Verifies and uses last ' +$
			'input parameter', uvalue='APPLY')

 widget_control, mini_base, /realize

 xmanager, 'widget_input_ran', mini_base, $
		group=group, event_handler='uvspcat_event' , /modal


 ;
 ; If new parameter, then parse and check
 ;

 legal = 0

 if new_param ne '' then $
    uvsp_catparam, str=str, out=out, legal=legal, nofull=nofull, $
			input=input + ' ' + new_param 


return, legal
end

;
;======================================================================
;

; returns LEGAL gt 0 if user input valid parameter value 

function widget_input, input=input, group=group, str=str, out=out, $
		  current=current, cat_widg=cat_widg, nofull=nofull

common user_s_input, new_param, apply
common passers, yield, inhib, notfull


 new_param = ''		; will be replaced with the user's new parameter value

 ;
 ; Create the widget showing current values and letting user input 
 ; new values
 ;

 if cat_widg.group eq '' then begin xoff = 20 & yoff=50   ; second level widg
 endif else begin xoff = 30 & yoff=75 			  ; third level widget
 endelse		  

 mini_base = widget_base(title='UVSP Catalog parameter input', /column, $
			 xoffset=xoff, yoffset=yoff, xpad=30, ypad=30, space=25)

  user_put = widget_base(mini_base, /row)   
     lab = widget_label(user_put, value='Enter new '+input+' and RETURN: ')
     in_text = widget_text(user_put, /scroll, ysize=1, xsize=60, /editable, $
			   	     uvalue='USER_INPUT')

  info = widget_base(mini_base, /row)
     lab = widget_label(info, value='Current parameter for '+input+' :')
     cur_text = widget_text(info, /scroll, ysize=1, xsize=60, value=current)

  message = ''
  UVSP_CATHELP, input=input, message=message

  help_win = widget_text(mini_base, xsize=72, ysize=10, /scroll, value=message)


  cancel= widget_button(mini_base, value='CANCEL :  Preserves current ' + $
			'parameter value shown above', uvalue='CANCEL')
  apply = widget_button(mini_base, value='READY :  Verifies and uses last ' +$
			'input parameter', uvalue='APPLY')

 widget_control, mini_base, /realize

 xmanager, 'widget_input', mini_base, $
		group=group, event_handler='uvspcat_event' , /modal


 ;
 ; If new parameter, then parse and check
 ;

 legal = 0

 if new_param ne '' then $
    uvsp_catparam, str=str, out=out, legal=legal, nofull=nofull, $
			input=input + ' ' + new_param 


return, legal
end


;=======================================================================


pro uvspcat_event, event
common uvcatstruc, str, out 			; the "parameter" and "where"
					 	;     structures
common passers, yield, inhib, notfull 			; pass to event handler
common myfont, myfont

common user_s_input, new_param, apply

common cat_bases, scrn, disk, prin, $		; the output choices
	  base, ran_lab, nam_lab, typ_lab, sli_lab, det_lab, xpi_lab, $
		ypi_lab, xre_lab, yre_lab, spe_lab, ang_lab, wld_lab, $
		shi_lab, int_lab, pol_lab, npo_lab, dur_lab, rsu_lab, $
		noa_lab, man_lab


 widget_control, event.id, get_uvalue=input
 widget_control, event.top, get_uvalue=cat_widg

 if n_elements(input) eq 0 then input=''
 type = strmid(tag_names(event, /structure_name),7,1000)

 case type of
    'BUTTON': case input of

		'HELP'    : UVSP_CATWIDHELP, group = event.top
		'FONT'    : myfont = xfont()
		'CANCEL'  : begin	
				new_param = ''
				widget_control, event.top, /destroy
			    end
		'QUIT'  : begin	
			        if (notfull ne 0) then free_lun, notfull
				widget_control, event.top, /destroy
			    end
		'APPLY'   : widget_control, event.top, /destroy  ; proceed


		'ARRAY'   :  if event.select then yield = yield or 1 $
					     else yield = yield - 1

		'SCREEN'  :  if event.select then yield = yield or 2 $
					     else yield = yield - 2

		'DISK'    :  if event.select then yield = yield or 8 $
					     else yield = yield - 8

		'PRINTER' :  if event.select then yield = yield or 4 $
					     else yield = yield - 4

		'INHIB'   : if event.select then inhib = 0 else inhib = 1

		'SEARCH'  : begin
				widget_control, base, sensitive=0
				cat_widg.group = event.id
				widget_control, base, /hourglass
				uvsp_catread, str=str, out=out, yield=yield, $
				    font=myfont, inhib=inhib, $
				    nofull=notfull, cat_widg=cat_widg
				widget_control, base, sensitive=1
			    end

		;
		; The reset parameter value buttons
		;

		'RES_ALL' : begin
			UVSP_CATRESET, str=str, out=out   ; no input means ALL
			if not(str.range_flag) then $
			     widget_control, ran_lab, set_value=':   '+str.tim $
			else widget_control, ran_lab, set_value=':   '+str.exp
			widget_control, nam_lab, set_value=':   '+str.name
			widget_control, typ_lab, set_value=':   '+str.type
			widget_control, sli_lab, set_value=':   '+str.slit
			widget_control, det_lab, set_value=':   '+str.det
			widget_control, xpi_lab, set_value=':   '+str.xpix
			widget_control, ypi_lab, set_value=':   '+str.ypix
			widget_control, xre_lab, set_value=':   '+str.xres
			widget_control, yre_lab, set_value=':   '+str.yres
			widget_control, spe_lab, set_value=':   '+str.spec
			widget_control, ang_lab, set_value=':   '+str.angs
			widget_control, wld_lab, set_value=':   '+str.wld
			widget_control, shi_lab, set_value=':   '+str.shft
			widget_control, int_lab, set_value=':   '+str.intvl
			widget_control, pol_lab, set_value=':   '+str.pol
			widget_control, npo_lab, set_value=':   '+str.npol
			widget_control, dur_lab, set_value=':   '+str.dur
			widget_control, rsu_lab, set_value=':   '+str.rsun
			widget_control, noa_lab, set_value=':   '+str.noaa
			widget_control, man_lab, set_value=':   '+out.man 
			end
		'RES_RAN' : begin
			UVSP_CATRESET, str=str, out=out, input='RAN'
			if not(str.range_flag) then $
			     widget_control, ran_lab, set_value=':   '+str.tim $
			else widget_control, ran_lab, set_value=':   '+str.exp
			end
		'RES_NAM' : begin
			UVSP_CATRESET, str=str, out=out, input='NAM'
			widget_control, nam_lab, set_value=':   '+str.name
			end
		'RES_TYP' : begin
			UVSP_CATRESET, str=str, out=out, input='TYP'
			widget_control, typ_lab, set_value=':   '+str.type
			end
		'RES_SLI' : begin
			UVSP_CATRESET, str=str, out=out, input='SLI'
			widget_control, sli_lab, set_value=':   '+str.slit
			end
		'RES_DET' : begin
			UVSP_CATRESET, str=str, out=out, input='DET'
			widget_control, det_lab, set_value=':   '+str.det
			end
		'RES_XPI' : begin
			UVSP_CATRESET, str=str, out=out, input='XPI'
			widget_control, xpi_lab, set_value=':   '+str.xpix
			end
		'RES_YPI' : begin
			UVSP_CATRESET, str=str, out=out, input='YPI'
			widget_control, ypi_lab, set_value=':   '+str.ypix
			end
		'RES_XRE' : begin
			UVSP_CATRESET, str=str, out=out, input='XRE'
			widget_control, xre_lab, set_value=':   '+str.xres
			end
		'RES_YRE' : begin
			UVSP_CATRESET, str=str, out=out, input='YRE'
			widget_control, yre_lab, set_value=':   '+str.yres
			end
		'RES_SPE' : begin
			UVSP_CATRESET, str=str, out=out, input='SPE'
			widget_control, spe_lab, set_value=':   '+str.spec
			end
		'RES_ANG' : begin
			UVSP_CATRESET, str=str, out=out, input='ANG'
			widget_control, ang_lab, set_value=':   '+str.angs
			end
		'RES_WLD' : begin
			UVSP_CATRESET, str=str, out=out, input='WLD'
			widget_control, wld_lab, set_value=':   '+str.wld
			end
		'RES_SHI' : begin
			UVSP_CATRESET, str=str, out=out, input='SHI'
			widget_control, shi_lab, set_value=':   '+str.shft
			end
		'RES_INT' : begin
			UVSP_CATRESET, str=str, out=out, input='INT'
			widget_control, int_lab, set_value=':   '+str.intvl
			end
		'RES_POL' : begin
			UVSP_CATRESET, str=str, out=out, input='POL'
			widget_control, pol_lab, set_value=':   '+str.pol
			end
		'RES_NPO' : begin
			UVSP_CATRESET, str=str, out=out, input='NPO'
			widget_control, npo_lab, set_value=':   '+str.npol
			end
		'RES_DUR' : begin
			UVSP_CATRESET, str=str, out=out, input='DUR'
			widget_control, dur_lab, set_value=':   '+str.dur
			end
		'RES_RSU' : begin
			UVSP_CATRESET, str=str, out=out, input='RSU'
			widget_control, rsu_lab, set_value=':   '+str.rsun
			end
		'RES_NOA' : begin
			UVSP_CATRESET, str=str, out=out, input='NOA'
			widget_control, noa_lab, set_value=':   '+str.noaa
			end
		'RES_MAN' : begin
			UVSP_CATRESET, str=str, out=out, input='MAN'
			widget_control, man_lab, set_value=':   '+out.MAN 
			end

		;
		; The set parameter value buttons
		;

		'RAN' :	begin
			if not(str.range_flag) then $
			     legal = WIDGET_INPUT_ran( input=input, $
				group=event.id, cat_widg=cat_widg, $
				str=str, out=out, nofull=notfull, $
				current=str.tim)   $
			else legal = WIDGET_INPUT_ran( input=input, $
				group=event.id, cat_widg=cat_widg, $
				str=str, out=out, nofull=notfull, $
				current=str.exp)

			if legal gt 0 then begin
			   if not(str.range_flag) then $
			     widget_control, ran_lab, $
					   set_value=':   '+str.tim  $
                           else widget_control, ran_lab, $
					   set_value=':   '+str.exp
			endif			

			end

		'NAM' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.name, nofull=notfull)

                        if legal gt 0 then widget_control, nam_lab, $
					   set_value=':   '+str.name
			end

			
		'TYP' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.type, nofull=notfull )

                        if legal gt 0 then widget_control, typ_lab, $
					   set_value=':   '+str.type 
			end

		'SLI' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.slit, nofull=notfull  )

                        if legal gt 0 then widget_control, sli_lab, $
					   set_value=':   '+str.slit
			end

		'DET' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.det, nofull=notfull)

                        if legal gt 0 then widget_control, det_lab, $
					   set_value=':   '+str.det
			end

		'XPI' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.xpix, nofull=notfull )

                        if legal gt 0 then widget_control, xpi_lab, $
					   set_value=':   '+str.xpix
			end

		'YPI' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.ypix, nofull=notfull )

                        if legal gt 0 then widget_control, ypi_lab, $
					   set_value=':   '+str.ypix
			end

		'XRE' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.xres, nofull=notfull )

                        if legal gt 0 then widget_control, xre_lab, $
					   set_value=':   '+str.xres
			end

		'YRE' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.yres, nofull=notfull )

                        if legal gt 0 then widget_control, yre_lab, $
					   set_value=':   '+str.yres
			end

		'SPE' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out,   $
				current=str.spec, nofull=notfull )

                        if legal gt 0 then widget_control, spe_lab, $
					   set_value=':   '+str.spec
			end

		'ANG' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.angs, nofull=notfull )

                        if legal gt 0 then widget_control, ang_lab, $
					   set_value=':   '+str.angs
			end

		'WLD' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out,  $
				current=str.wld, nofull=notfull)

                        if legal gt 0 then widget_control, wld_lab, $
					   set_value=':   '+str.wld 
			end

		'SHI' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.shft, nofull=notfull)

                        if legal gt 0 then widget_control, shi_lab, $
					   set_value=':   '+str.shft
			end

		'INT' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.intvl, nofull=notfull)

                        if legal gt 0 then widget_control, int_lab, $
					   set_value=':   '+str.intvl
			end

		'POL' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.pol, nofull=notfull  )

                        if legal gt 0 then widget_control, pol_lab, $
					   set_value=':   '+str.pol 
			end

		'NPO' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.npol, nofull=notfull )

                        if legal gt 0 then widget_control, npo_lab, $
					   set_value=':   '+str.npol
			end

		'DUR' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.dur, nofull=notfull  )

                        if legal gt 0 then widget_control, dur_lab, $
					   set_value=':   '+str.dur 
			end

		'RSU' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.rsun, nofull=notfull )

                        if legal gt 0 then widget_control, rsu_lab, $
					   set_value=':   '+str.rsun
			end

		'NOA' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=str.noaa , nofull=notfull)

                        if legal gt 0 then widget_control, noa_lab, $
					   set_value=':   '+str.noaa
			end

		'MAN' : begin
			legal = WIDGET_INPUT( input=input, group=event.id, $
				cat_widg=cat_widg, str=str, out=out, $
				current=out.man, nofull=notfull )

                        if legal gt 0 then widget_control, man_lab, $
				set_value=':   '+out.man	
                        end

		;
		; Buttons for the range input widget
		;
                     
		'!WLD':  begin  
		 	new_param = input
		 	widget_control, apply, set_value='READY : If valid ' + $
					'use -> ' + input
	      		end
		'!80' : begin  	
			new_param = input
			widget_control, apply, set_value='READY : If valid ' + $
					'use -> ' + input
		        end
		'!84' : begin  	
			new_param = input
			widget_control, apply, set_value='READY : If valid ' + $
					'use -> ' + input
		        end
		'!85' : begin  	
			new_param = input
			widget_control, apply, set_value='READY : If valid ' + $
					'use -> ' + input
		        end
		'!86' : begin  	
			new_param = input
			widget_control, apply, set_value='READY : If valid ' + $
					'use -> ' + input
		        end
		'!87' : begin  	
			new_param = input
			widget_control, apply, set_value='READY : If valid ' + $
					'use -> ' + input
		        end
		'!88' : begin  	
			new_param = input
			widget_control, apply, set_value='READY : If valid ' + $
					'use -> ' + input
		        end
		'!89' : begin  	
			new_param = input
			widget_control, apply, set_value='READY : If valid ' + $
					'use -> ' + input
		        end

		'!AERO' : print,'not yet available'

	         else: print,'Error - no such button ',input
	     endcase

    'TEXT'  : begin    
              widget_control, event.id, get_value=value, set_value=''
              if value(0) eq '' then return 		; no input provided

	      if input eq 'USER_INPUT' then begin  	; from WIDGET_INPUT
		 new_param = value(0)
		 widget_control, apply, set_value='READY : If valid ' + $
					'use -> ' + value(0)
	      endif
	      end
	 
    else: print,'Error - no such type ',type
 endcase

return
end

;=============================================================================


; ARRAY is set if call by the UVSP.PRO code, only the array is return

pro uvsp_catwidget, str=str_1, out=out_1, nofull=nofull, cat_widg=cat_widg

common uvcatstruc, str, out 			; the "parameter" and "where"
					 	;     structures
common passers, yield, inhib, notfull 			; pass to event handler
common myfont, myfont

common cat_bases, scrn, disk, prin, $		; the output choices
	  base, ran_lab, nam_lab, typ_lab, sli_lab, det_lab, xpi_lab, $
		ypi_lab, xre_lab, yre_lab, spe_lab, ang_lab, wld_lab, $
		shi_lab, int_lab, pol_lab, npo_lab, dur_lab, rsu_lab, $
		noa_lab, man_lab


 if xregistered('uvsp_catwidget') then return

 notfull = nofull			; change the name for the common

 str = str_1
 out = out_1
 yield = 2b					; default is to text widget 
 inhib = 1					; defalut, no blank lines
 
 if cat_widg.group eq '' then $               ; the top most base
      base = widget_base(title='UVSP Catalog Program Version 1.0', /column, $
		    xpad=25, ypad=25)     $
 else base = widget_base(title='UVSP Catalog Program Version 1.0', /column, $
		    xoffset=20, yoffset=50, xpad=25, ypad=25)


 control = widget_base(base, /row)

  instruct_base = widget_base(control, /column)
    lab = widget_label(instruct_base, font=myfont, $
	  	value='Click on the buttons below to change parameters.')
    lab = widget_label(instruct_base, font=myfont, $
		value='The current settings are shown to the right.')
    lab = widget_label(instruct_base, value=' ')

    inhib_base = widget_base(instruct_base, /nonexclusive, /frame) 
       inhibit = widget_button(inhib_base, font=myfont, $
		    value='Insert blank lines between orbits', uvalue='INHIB')


  control_base = widget_base(control, /row)

   col1 = widget_base(control_base, /column)
     xpdmenu, ['"RESET" {',                $
                '"all" RES_ALL',    	   $
		'"RAN " RES_RAN',          $
                '"NAME" RES_NAM',          $
                '"TYPE" RES_TYP',          $
                '"SLIT" RES_SLI',          $
                '"DET " RES_DET',          $
                '"XPIX" RES_XPI',          $
                '"YPIX" RES_YPI',          $
                '"XRES" RES_XRE',          $
                '"YRES" RES_YRE',          $
                '"SPEC" RES_SPE',          $
                '"ANGS" RES_ANG',          $
                '"WLD " RES_WLD',          $
                '"SHIFT" RES_SHI',         $
                '"INTVL" RES_INT',         $
                '"POL " RES_POL',          $
                '"NPOL" RES_NPO',          $
                '"DUR " RES_DUR',          $
                '"RSUN" RES_RSU',          $
                '"NOAA" RES_NOA',          $
                '"MAN " RES_MAN',          $
                 '}' ], col1, font=myfont
     help = widget_button(col1, value='HELP', uvalue='HELP', font=myfont)
     font = widget_button(col1, value='FONT', uvalue='FONT', font=myfont)

   col2 = widget_base(control_base, /nonexclusive, /column, /frame)
     arry= widget_button(col2, value='Array', uvalue='ARRAY', font=myfont)
     scrn= widget_button(col2, value='Screen', uvalue='SCREEN', font=myfont)
     disk= widget_button(col2, value='Disk File', uvalue='DISK', font=myfont)
     prin= widget_button(col2, value='Printer', uvalue='PRINTER', font=myfont)
	
   col3 = widget_button(control_base,value='SEARCH',uvalue='SEARCH',font=myfont)
   col3 = widget_button(control_base, value='QUIT',uvalue='QUIT', font=myfont)

 in_base = widget_base(base, /column, /frame)

 ran_base = widget_base(in_base, /row)
    ran_but = widget_button(ran_base, value='RAN  ', uvalue='RAN', font=myfont)
    if str.range_flag $
       then ran_lab= widget_label(ran_base, value=':   '+str.exp, font=myfont) $
       else ran_lab= widget_label(ran_base, value=':   '+str.tim, font=myfont)


 nam_base = widget_base(in_base, /row)
    nam_but = widget_button(nam_base, value='NAME ', uvalue='NAM', font=myfont)
    nam_lab = widget_label(nam_base, value=':   '+str.name, font=myfont)
 typ_base = widget_base(in_base, /row)
    typ_but = widget_button(typ_base, value='TYPE ', uvalue='TYP', font=myfont)
    typ_lab = widget_label(typ_base, value=':   '+str.type, font=myfont)
 sli_base = widget_base(in_base, /row)
    sli_but = widget_button(sli_base, value='SLIT ', uvalue='SLI', font=myfont)
    sli_lab = widget_label(sli_base, value=':   '+str.slit, font=myfont)
 det_base = widget_base(in_base, /row)
    det_but = widget_button(det_base, value='DET  ', uvalue='DET', font=myfont)
    det_lab = widget_label(det_base, value=':   '+str.det, font=myfont)
 xpi_base = widget_base(in_base, /row)
    xpi_but = widget_button(xpi_base, value='XPIX ', uvalue='XPI', font=myfont)
    xpi_lab = widget_label(xpi_base, value=':   '+str.xpix, font=myfont)
 ypi_base = widget_base(in_base, /row)
    ypi_but = widget_button(ypi_base, value='YPIX ', uvalue='YPI', font=myfont)
    ypi_lab = widget_label(ypi_base, value=':   '+str.ypix, font=myfont)
 xre_base = widget_base(in_base, /row)
    xre_but = widget_button(xre_base, value='XRES ', uvalue='XRE', font=myfont)
    xre_lab = widget_label(xre_base, value=':   '+str.xres, font=myfont)
 yre_base = widget_base(in_base, /row)
    yre_but = widget_button(yre_base, value='YRES ', uvalue='YRE', font=myfont)
    yre_lab = widget_label(yre_base, value=':   '+str.yres, font=myfont)
 spe_base = widget_base(in_base, /row)
    spe_but = widget_button(spe_base, value='SPEC ', uvalue='SPE', font=myfont)
    spe_lab = widget_label(spe_base, value=':   '+str.spec, font=myfont)
 ang_base = widget_base(in_base, /row)
    ang_but = widget_button(ang_base, value='ANGS ', uvalue='ANG', font=myfont)
    ang_lab = widget_label(ang_base, value=':   '+str.angs, font=myfont)
 wld_base = widget_base(in_base, /row)
    wld_but = widget_button(wld_base, value='WLD  ', uvalue='WLD', font=myfont)
    wld_lab = widget_label(wld_base, value=':   '+str.wld, font=myfont)
 shi_base = widget_base(in_base, /row)
    shi_but = widget_button(shi_base, value='SHIFT', uvalue='SHI', font=myfont)
    shi_lab = widget_label(shi_base, value=':   '+str.shft, font=myfont)
 int_base = widget_base(in_base, /row)
    int_but = widget_button(int_base, value='INTVL', uvalue='INT', font=myfont)
    int_lab = widget_label(int_base, value=':   '+str.intvl, font=myfont)
 pol_base = widget_base(in_base, /row)
    pol_but = widget_button(pol_base, value='POL  ', uvalue='POL', font=myfont)
    pol_lab = widget_label(pol_base, value=':   '+str.pol, font=myfont)
 npo_base = widget_base(in_base, /row)
    npo_but = widget_button(npo_base, value='NPOL ', uvalue='NPO', font=myfont)
    npo_lab = widget_label(npo_base, value=':   '+str.npol, font=myfont)
 dur_base = widget_base(in_base, /row)
    dur_but = widget_button(dur_base, value='DUR  ', uvalue='DUR', font=myfont)
    dur_lab = widget_label(dur_base, value=':   '+str.dur, font=myfont)
 rsu_base = widget_base(in_base, /row)
    rsu_but = widget_button(rsu_base, value='RSUN ', uvalue='RSU', font=myfont)
    rsu_lab = widget_label(rsu_base, value=':   '+str.rsun, font=myfont)
 noa_base = widget_base(in_base, /row)
    noa_but = widget_button(noa_base, value='NOAA ', uvalue='NOA', font=myfont)
    noa_lab = widget_label(noa_base, value=':   '+str.noaa, font=myfont)
 man_base = widget_base(in_base, /row)
    man_but = widget_button(man_base, value='MAN  ', uvalue='MAN', font=myfont)
    man_lab = widget_label(man_base, value=':   '+out.man , font=myfont)


 widget_control, base, /realize

 widget_control, base, set_uvalue=cat_widg	; the CATDISPLAY structure

 widget_control, scrn, /set_button 	  		

 if cat_widg.handler eq '' then $
      xmanager, 'uvsp_catwidget', base, event_handler='uvspcat_event'  $
 else xmanager, 'uvsp_catwidget', base, event_handler='uvspcat_event', $
			group_leader=cat_widg.group


return
end