startmacro s:themeName
  lookandfeel ^themeName

  call setDatDir

  invoke descr nxm.sys.lib.Theme.getTheme(themeName)
  res    inst  "Check to see the theme of the current panel matches the &
                description below."
  
  pipe init
    panel/msgid=MAIN/setup/controls=gc
    plot/id=idplot ^{datDir}.apenny.prm
    
    gcontrol label macro "MACRO"
    gcontrol menu main   "Exit with Status = " "PASS,FAIL"   /tleft
    set gc.MAIN.itemColors {PASS=GREEN,FAIL=RED}
    gcontrol text idtext "Instructions"        "^inst"  24 5 /title
    gcontrol text descr  "Theme Description"   "^descr" 24 5 /title
  pipe off
endmacro

!******************************************************************************!
procedure processMessage m:msg
  !say "msg.name ^msg.name, data ^msg.data"

  if msg.name eqs "MAIN" then
    assert/text="Testing theme ^themeName" msg.data eqss "PASS" 
    pipe stop
  else
    ! do nothing
    ! say "Unhandled message name: ^msg.name from fid: ^msg.fid dats: ^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
