FUNCTION cwq_cube,base,qlds,windowi,uvalue=uvalue,xsize=xsize,ysize=ysize,$
                  row=row,frame=frame
  
  IF since_version('4.0') then sml=1 else sml=0
  sml2 = 1
  
  small = {xpad:sml,ypad:sml,space:sml}
  default,frame,0
  
  mybase = widget_base(base,/column,_extra=small,frame=frame,$
                       event_func='cwq_cube_event', $
                       pro_set_value='cwq_cube_setv')
  
  IF n_elements(uvalue) NE 0 THEN widget_control,mybase,set_uvalue=uvalue
  
  stash = widget_base(mybase,_extra=small)
  
  selector_id = cwq_winsel(mybase,qlds,title='Win: ',uvalue='CWQ_WINSEL',$
                           initial=windowi)
  
  ndim = n_elements(qlds.detdesc(windowi).axes)
  
  ;; Only scale X vs Y
  phys_scale = ([0,1,1,0])(0:ndim-1)
  
  origin = qlds.detdesc(windowi).origin
  scale = qlds.detdesc(windowi).spacing
  dimnames = qlds.detdesc(windowi).axes
  
  IF ndim EQ 3 THEN image_dim=[1,2] $
  ELSE IF ndim EQ 4 THEN image_dim=[3,2] $ ;; Time vs Y
  ELSE image_dim=[0,1]
  
  oldsys = tag_exist(qlds,'DETDATA')
  IF oldsys THEN BEGIN
     value = gt_windata(qlds,windowi)
     handle = handle_create(value=value,/no_copy)
     handle_killer_hookup,handle,group_leader=base
  END ELSE BEGIN
     handle = qlds.detdesc(windowi).handle
  END
  
  missing = qlds.detdesc(windowi).missing
  
  cw_cube_id = cw_cubeview(mybase,hvalue=handle,dimnames=dimnames,$
                           origin=origin,scale=scale,phys_scale=phys_scale,$
                           image_dim=image_dim,plot_dim=0,row=row,$
                           missing=missing,uvalue='CW_CUBE',$
                           xsize=xsize,ysize=ysize)
  
  status = { ql_no : qlds.ql_no,$
             handle : handle,$
             oldsys : oldsys,$
             cw_cube_id : cw_cube_id,$
             windowi : windowi,$
             focus : lonarr(ndim)}
  
  widget_control,stash,set_uvalue=status
  
  return,mybase
  
END