!------------------------------------------------------------------------------!
! Tests for LIST2 command.
!
!   Author : J. Czechowski IV
!------------------------------------------------------------------------------!
startmacro/tsetup=nxm.sys.test.test_list2_setup_clickaction.tbl
  switch INTERACTIVE  interAct     GET DEF=TRUE
  switch standalone   standalone   GET DEF=TRUE
  switch COREGRAPHICS coregraphics GET DEF=FALSE SDEF=TRUE  ! for a quick check of graphics - more extreme tests - since 3.8.1

  call setDatDir

  if interAct OR coreGraphics then
! Col selection is known DR, Bug 1352
    set instructions {}
    set instructions.1 "CELL click selects ROW"
    set instructions.2 "CELL click selects COL"
    set instructions.3 "CELL click selects CELL. Double-Click on cell should NOT &
                         enter 'edit' mode on the cell"
    set instructions.4 "All selection disabled"
    set instructions.5 "COL click sorts data"
    set instructions.6 "(Known DR) COL click selects COL, ROW click selects ROW"

    set noSortTempl {}
    set noSortTempl._GLOBAL_ {SORTENABLED=OFF}
    set doSortTempl {}
    set doSortTempl._GLOBAL_ {SORTENABLED=ON}

    pipe init
      panel/msgid=MAIN/id=panel/controls=gc

      list2/msgid=MAIN/id=list1 ^{datDir}.testxy3000.prm noSortTempl CLICKACTION={CELL=ROW,COL=NONE,ROW=NONE}
      list2/msgid=MAIN/id=list2 ^{datDir}.testxy3000.prm noSortTempl CLICKACTION={CELL=COL,COL=NONE,ROW=NONE}
      list2/msgid=MAIN/id=list3/editable=f ^{datDir}.testxy3000.prm noSortTempl CLICKACTION={CELL=SELECT,COL=NONE,ROW=NONE}
      list2/msgid=MAIN/id=list4 ^{datDir}.testxy3000.prm noSortTempl CLICKACTION={CELL=NONE,COL=NONE,ROW=NONE}
      list2/msgid=MAIN/id=list5 ^{datDir}.testxy3000.prm doSortTempl CLICKACTION={CELL=NONE,COL=SORT,ROW=NONE}
      list2/msgid=MAIN/id=list6 ^{datDir}.testxy3000.prm noSortTempl CLICKACTION={CELL=NONE,COL=SELECT,ROW=SELECT}
      if standalone isTrue then
        gcontrol label  macro   "MACRO"
        gcontrol menu MAIN "Exit with Status = " "PASS,FAIL" /tleft
        set gc.MAIN.itemColors {PASS=GREEN,FAIL=RED}
      endif

      gcontrol label  instLabel  "Instructions"
      gcontrol panel  instDispl  "Instructions" 200 300

      textdisplay/id=instDispl TEXT=instructions

    pipe off
  endif
endmacro

!------------------------------------------------------------------------------!
! Procedure for handling all messages
procedure processMessage m:msg
  !say "Got msg.name=^msg.name msg.info=^msg.info msg.data=^msg.data"

  if msg.name EQS "MAIN" then
    if msg.data EQS "EXIT" then
      pipe stop
    else
      assert/text="LIST2 tests" "PASS" SUBS msg.data
      pipe stop
    endif
  
  elseif msg.fid eqs "LIST1" then

  elseif msg.fid eqs "LIST2" then

  elseif msg.fid eqs "LIST3" then

  elseif msg.fid eqs "LIST4" then

  elseif msg.fid eqs "LIST5" then

  elseif msg.fid eqs "LIST6" then

  else
    say "Unhandled messagename: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

!******************************************************************************!
! Set the dat directory
!******************************************************************************!
procedure setDatDir
  invoke nxmMajor env.nmversion.subString(0,1)
  invoke major java.lang.Integer.valueOf(nxmMajor)
  if major GE 4 then
    invoke s:datDir           nxm.sys.test.DatLocator.getDatDirLocation()
    invoke s:datDirSlash      nxm.sys.test.DatLocator.getDatDirSlashLocation()
    invoke z:sysDatFull       nxm.sys.test.DatLocator.sysDatFull()
    invoke z:sysTestDatExists nxm.sys.test.DatLocator.sysTestDatExists()
  else
    set s:datDir           "nxm.sys.dat"
    set s:datDirSlash      "nxm/sys/dat"
    set z:sysDatFull       true
    set z:sysTestDatExists false
  endif
return
