!******************************************************************************!
! Tests a panel with /TSETUP
!
! @author  J. Hallam / J Bauer
!******************************************************************************!
startmacro
  switch INTERACTIVE  interAct     GET DEF=TRUE  SDEF=TRUE
  switch BASELINE     baseline     GET DEF=FALSE SDEF=TRUE
  switch COREGRAPHICS coreGraphics GET DEF=FALSE SDEF=TRUE ! for a quick check of graphics - more extreme tests - since 3.8.1

  set inst "Click the 'Launch /TSETUP=RESULT' button. &
            The macro will come up non-configured (you have to move some panels and expand the &
            control panel width to see the PASS/FAIL).\n\nConfigure it (attach the plot) &
            and save the setup to a result using MMB->Configure->SaveResult. &
            Use the default result name.\n\nClose the launched macro by clicking PASS.&
            \n\nOn the original macro, again click on the same button. This time, the &
            launched macro should come up configured.\n\nClose the launched macro.\n\n&
            Click on the button labeled 'Launch /TSETUP=.TBL'. The same sub-macro &
            should launch, again non-configured.\n\nConfigure it and this time save &
            as a .tbl file using MMB->Configure->Save. Use the default filename.\n\n&
            Close the launched macro and then click on the button again. The macro &
            should come up configured.\n\nClose the launched macro and click PASS &
            on this macro if all worked.\n\n*NOTE: MMB in the bottom left corner of the popup &
            to save the setup."

  set setupfilename "mysetupfile.tbl"

  if interAct or coreGraphics then
    pipe on
      panel/msgid=MAIN/controls=gc/tsetup
      textdisplay text=inst

      gcontrol label macro "MACRO"
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
        set gc.main.itemColors {PASS=GREEN,FAIL=RED}
        gcontrol text idtext "Instructions" "Should see detailed instructions in the main pane to the right." 30 5 /title

        gcontrol button launch1 "" "Launch /TSETUP=RESULT"
        gcontrol button launch2 "" "Launch /TSETUP=.TBL"

    pipe off

  endif

  ! cleanup
  rem setupTable
  if setupfilename fexists then
    erase setupfilename   ! remove the evidence
  endif
endmacro

!******************************************************************************!
procedure processMessage
  if msg.name EQS "MAIN" then
    assert/text="Tests for /TRESULT" msg.data eqss "PASS"
    pipe stop
  elseif msg.name eqs "LAUNCH1" then
    %test_panel_tsetup_result /tsetup=myRes /wpos=(400,200,600,600)
  elseif msg.name eqs "LAUNCH2" then
    %test_panel_tsetup_result  /tsetup=^setupfilename /wpos=(500,300,600,600)
  endif
return
