! This tests the primlab8 command.
!
startmacro
  set instr "Try zooming and clicking on the top plot. You should see the &
             associated message displayed below. Also, if you zoom or unzoom &
             in the top plot, the bottom plot should do likewise."


  pipe on
    panel/setup/controls=gc
    plot/id=plot1 nxm.sys.dat.world.prm
    primlab8/id=myprim main plot1
    plot/id=plot2/msgid=myprim nxm.sys.dat.world.shp
    
    gcontrol text idtext "Instructions" "^instr" 24 7 /title

    gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
    set gc.main.itemColors {PASS=GREEN,FAIL=RED}

    gcontrol label  label "Received Message"
    gcontrol prompt name  "Name"  "" 16 /msg=no /edit=no
    gcontrol prompt info  "Info"  "" 16 /msg=no /edit=no
    gcontrol prompt data  "Data"  "" 16 /msg=no /edit=no

    
  pipe off
endmacro


procedure processMessage m:msg
  !say "got message name=^msg.name info=^msg.info data=^msg.data"

  if msg.fid eqs "MYPRIM" then
    set gc.name.value msg.name
    set gc.info.value msg.info
    set gc.data.value msg.data
  elseif msg.name eqs "MAIN" then
    assert/text="primlab8 tests" msg.data eqss "PASS"
    pipe stop
  else
    say "Unhandled message name=^msg.name data=^msg.data"
  endif
return
