!******************************************************************************!
! Show the problem with adding a sub-Macro panel to the parent via the config
! popup menu.
!
! @bug     2013,2014
! @author  J Bauer
! @since   NeXtMidas 2.7.3
!******************************************************************************!
startmacro
  ! NXM-3845 since NeXtMidas 4.1.1
  if ^{env.NMROOT} EQS "classpath:" then
    info "SKIPPING ^reg.main.name since fails when running from a jar file - &
          this test involves creating a .mmp file and saving it inside a jar file"
  else
    set instructions "Instructions:\n&
                      There should be a panel containing 2 panes (a plot of the world and &
                      a list2 of cities) in a separate window. &
                      (if not see instructions below).\n\n&
                      1) Move separate panel to the panel in THIS macro\n&
                      1a) add a pane to the panel at the right:\n&
                      \tMMB->Configure->Modify\n&
                      \tMMB->Pane\n&
                      1b) attach 'CHILD_MACRO' to it\n&
                      \tMMB->Attach->CHILD_MACRO\n\n&
                      2) Save the setup file\n&
                      (at bottom left) MMB->Configure->Save\n\n&
                      3) Close this macro, and re-run it. At that point, you should see the plot &
                      inside the panel. NOTE: if this test is running as part of the &
                      confidence tests, the macro will immediately re-appear and you &
                      should see the plot inside the macro panel you added it to.\n&
                      __________________________\n&
                      Instructions if you already see a plot and list2 of cities in THIS macro panel to the right:\n&
                      1) Click the button below to remove the setup file\n&
                      2) Re-run this macro.\n&
                      __________________________\n&
                      Test Objective: to move the macro at the right &
                      (containing a plot of the world) to the panel in THIS macro &
                      using the config menu."

    pipe on
      panel/msgid=MAIN/setup/controls=gc/panes=win2/id=mainpanel

      gcontrol/panel=mainpanel label macro "MACRO"
      gcontrol/panel=mainpanel menu MAIN "Exit with Status = " "PASS,FAIL" /tleft
      set gc.MAIN.itemColors {PASS=GREEN,FAIL=RED}

      gcontrol/panel=mainpanel text idtext "INSTRUCTIONS" "^instructions" 24 30 /title

      gcontrol/panel=mainpanel button reset "" "RESET SETUP FILE"

      %test_panel_subs_child/bg/id=child_macro/win=win2.pane1
    pipe off
  endif
endmacro

!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="TEST_SUBPANEL" msg.data eqss "PASS"
    message sendw id=child_macro name=exit  ! close the child macro to avoid a warning for timeout
    pipe stop
  elseif msg.name eqs "RESET" then
    file name sourceFile (^{env.nmroot},nxm,sys,test) test_panel_subs_parent.mmp bk
    file copy/f sourceFile nxm.sys.test.test_panel_subs_parent.mmp
  endif
return