      program pikbox
      call gopks(0,-1)
      call gopwk(1,0,4)
      call gacwk(1)
      call gswn(1,0.0,100.0,0.0,100.0)
      call gsclip(0)
      call gselnt(1)
      call gscr(1,3,1.0,0.0,0.0)
      call gscr(1,4,0.0,1.0,1.0)
      call gsfaci(3)
      call gstxci(4)
      call gsfais(1)
      call gschh(5.0)
C
      call gtx(10.0,10.0,'Pick box 1 to Quit')
      call gschh(10.0)
      call gstxal(2,3)
      call box(1,10.0,40.0)
      call box(2,40.0,40.0)
      call box(3,70.0,40.0)
C
      call gspkm(1,1,0,0)
  100 call grqpk(1,1,istat,myseg,mypik)
      write(0,*)'Pick returns:',istat,myseg,mypik
      if(myseg.ne.1)goto 100
C
      call gdawk(1)
      call gclwk(1)
      call gclks
      end

      subroutine box(id,xp,yp)
      dimension xvec(4),yvec(4)
      character*1 c
      data size/20.0/
      call gcrsg(id)
      write(c,'(i1)')id
      xvec(1)=xp
      xvec(2)=xp+size
      xvec(3)=xvec(2)
      xvec(4)=xvec(1)
      yvec(1)=yp
      yvec(2)=yvec(1)
      yvec(3)=yp+size
      yvec(4)=yvec(3)
      call gfa(4,xvec,yvec)
      call gtx(xp+size*0.5, yp+size*0.5, c)
      call gclsg
      call gsvis(id,1)
      call gsdtec(id,1)
      return
      end
