!------------------------------------------------------------------------------!
! Tests for case where List2/MJList would just give popup waning & needs to log
!
!   @Issue  : NXM-4066 All ERROR/WARNING messages should be printed/logged by default
!   @Since  : NeXtMidas 4.1.4
!   @Author : Jeanette McCall
!------------------------------------------------------------------------------!
startmacro
  switch INTERACTIVE  interAct     GET DEF=TRUE

  if interAct then
    res t:rows {1={DUMMY_COL1="One"},2={DUMMY_COL1="Two"},3={DUMMY_COL1="Three"}}

    res t:templ {}   ! The template
    res templ._GLOBAL_ {AUTOHIDE="FALSE",AUTOORDER="TRUE"}
    res templ.DUMMY_COL1 {WIDTH=12,ALIGN="CENTER",TYPE="STRING",LABEL="DATA1"}
    res templ.DUMMY_COL2 {WIDTH=12,ALIGN="BADVALUE",TYPE="STRING",LABEL="DATA2"}

    pipe on

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

      res instructions "You should see a both a popup and a warning for:\n&
          MJList:Invalid column template entry 'ALIGN=BADVALUE' for column DUMMY_COL2. "
      gcontrol text idtext "Instructions" "^instructions" 24 12 /title

      gcontrol line line1

      INFO "!!!!! It is ok to see a message below for 'LIST2: No input file found, creating a Type 3000 RamFile... !!!!!"

      list2/id=mylist/msgid=main template=templ

      call loadData

    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"
    erase test_tmpl_blue.tbl test_tmpl_red.tbl
    pipe stop
  
  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

!******************************************************************************!
! load the data into the List2
!******************************************************************************!
procedure loadData
  invoke reg.mylist.removeAllRows()
  do ii 1 3
    set reg.mylist.addRow ^rows.^{ii}
  enddo
return

