subr histselect_cb
 $subareatype = 1	;a rectangular subarea
 ;need the image window
 w1 = fix(xmtextfieldgetstring ($histtext1)
 get_box_image, w1, x1, x2, y1, y2, $hist_rec_but
 xflush
 convertfordata, x1, y1, w1
 convertfordata, x2, y2, w1
 ;now make the 1's smaller than the 2's
 if x1 gt x2 then switch, x1, x2
 if y1 gt y2 then switch, y1, y2

 xmtextfieldsetstring,$histrangetext(0),istring(x1,1)
 xmtextfieldsetstring,$histrangetext(2),istring(x2,1)
 xmtextfieldsetstring,$histrangetext(1),istring(y1,1)
 xmtextfieldsetstring,$histrangetext(3),istring(y2,1)
 endsubr
 ;===============================================================================
