!
! POPUP a SelfCal result display.
!   POPUP Number    will popup the corresponding Antenna
!   POPUP     will call cursor to select the panel
define logical done_init
done_init = exist(self_box_number)
!
begin procedure pop_self_box
  @ find_window_number 'phy_curs[1]' 'phy_curs[2]' self_box_number
  @ plot_self_box 'PopupName' 'self_box_number'
  gtvl\change directory <GREG
end procedure pop_self_box
!
! If possible, re-use existing sub-procedure
if (done_init) then
  if (pro%narg.eq.0) then
    greg1\look "@ pop_self_box"
  else
    @ plot_self_box 'PopupName' &1
    gtvl\change directory <GREG
  endif
  return
endif
! If first time, create sub-procedure and global Box number
define integer self_box_number /global
!
begin procedure plot_self_box
  on error return
  if exist(last_popup_) then
    gtvl\change dir <greg<self'last_popup_'
    gtvl\destroy window
  else
    defi integer last_popup_ /global
  endif
  on error return base
  gtvl\change dir <greg<&1&2
  gtvl\create window name "Antenna &2" /POSITION 100% 100%
  gtvl\change dir <greg
  let last_popup_ &2
end procedure plot_self_box
!
if (pro%narg.eq.0) then
  greg1\look "@ pop_self_box"
else
  @ plot_self_box 'PopupName' &1
  gtvl\change directory <GREG
endif
