!******************************************************************************!
! Test a macro with a list2 launched from another macro with no file specified
! and a template with the columns for the data that it should contain.
!
! Arguments: None
!
! @bug      2396
! @author:  J Bauer
! @version: $Id: test_list2_submacro.mm,v 1.2 2011/06/02 17:31:15 ntn Exp $
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)

if interAct then
  set sr 1e5
  set instructions "Click the button to launch the submacro"

  pipe init
    panel/setup/controls=gc/msgid=main
      gcontrol label macro "Test MACRO"
      gcontrol menu  main "Exit with Status =" "PASS,FAIL" TABLE={ItemColors={PASS="GREEN",FAIL="RED"}} /tleft
      gcontrol text  idtext "Instructions" instructions 24 8 /title

      list2/msgid=main/id=idlist template={X={},Y={}}

      gcontrol button myButt "" "LAUNCH SUBMACRO"
      gcontrol button addRow "" "Add Row"
      set reg.idlist.addRow {X=2,Y=3}

  pipe off
endif

endmacro

!******************************************************************************!
! Main process message for this macro. Should be right after the ENDMACRO.
procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop

  elseif msg.name eqs "MYBUTT" then
    %test_list2_submacro_sub/interactive=^interAct/bg

  elseif msg.name eqs "ADDROW" then
    set reg.idlist.addRow {X=4,Y=5}

  endif

return
