!
! Test to highlight issues with LIST when using tabbed panes (from NetBeans)
!  and also when using the NIMBUS look and feel
!
! @author  J. Bauer / Beth Hassler

startmacro/jsetup=nxm.sys.test.test_list_jsetup s:LAFName["ocean"]

  set laf_orig ^env.theme   ! keep reference to the original look and feel
  lookandfeel LAFName

  call setDatDir

  set counter 0

  pipe init

  panel/id=panel/msgid=main/controls=gc
  
  list/id=list1/drawhidden ^{datDir}.test6000.prm
  
  list/id=list2/drawhidden/collabels=yes/rowlabels=no/dragdrop ^{datDir}.test6000.prm cursor=cell hilite=fore hcolor=green
  
  gcontrol button "ADDROW" "" "Add Row"
  gcontrol button "PASS"   "" "Pass"
  gcontrol button "FAIL"   "" "Fail"

  pipe wait
  pipe off

endmacro
!
procedure processMessage m:msg

  if msg.name eqs "ADDROW"
    calc counter counter 1 +
    set t:test {F1="JUNK1_^counter",R1="JUNK",CC=9999,FF=9000,GG="Testing"}
    pause 0.01
    invoke ,, reg.list1.addRow(test)

    set test.F1 "JUNK2_^counter"
    pause 0.01
    invoke ,, reg.list2.addRow(test)

  elseif msg.name eqs "FAIL" or msg.name eqs "PASS" then
    assert/text="^reg.main.name: Interactive tests" msg.name eqss "PASS"
    lookandfeel laf_orig
    pipe stop

  elseif msg.data eqs "CLOSING" then
    lookandfeel laf_orig
    pipe stop

  elseif msg.name eqss "JTABBED" or msg.name eqss "JBUTTON" then
    !do nothing

  else
    say "Got unhandled message ^msg.name ^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
