startmacro
!******************************************************************************!
! Tests the GCONTROL /WAIT switch.  Uses the TABLE= parameter to set the /WAIT control itemcolors
!
! @author  jph
! @version $Id: test_gcontrol_switch_wait.mm,v 1.2 2011/07/07 19:24:49 ntn Exp $
!******************************************************************************!
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)

if interAct then

  set popupTheme "JAVA"
  set waitItemColors {ITEM1=PURPLE,ITEM2=DARKGREEN}
  set mainItemColors {PASS=GREEN,FAIL=RED}
  set myInstructions "'Exit with Status' menu should have PASS in ^{mainItemColors.PASS} and FAIL in ^{mainItemColors.FAIL}. &
                      Push 'Press to show MENU with /WAIT switch' and a menu should come up with a ^popupTheme theme and &
                      the default item should be ITEM1 in ^{waitItemColors.ITEM1}. ITEM2 should be ^{waitItemColors.ITEM2}"
  pipe on

    panel/msgid=MAIN/setup/controls=gc

    gcontrol label  macro "MACRO"
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemcolors mainItemColors
      gcontrol TEXT idtext INSTRUCTIONS "^myInstructions" 24 6 /title

    gcontrol label  tests "TESTS"
      gcontrol BUTTON showWait  "" "Press to show MENU with /WAIT switch" /tleft /nodepress

  pipe off
endif

endmacro

!******************************************************************************!
procedure processMessage m:msg

  if msg.name eqs "MAIN"
    assert/text="^reg.main.name: user indicated" msg.data eqs "PASS"
    pipe stop

  elseif msg.name eqs "SHOWWAIT"  then
    gcontrol/wait/msg=f/wtheme=^popupTheme menu waitMenu "MENU/WAIT" "ITEM1,ITEM2" TABLE={ITEMCOLORS=^waitItemColors}

  else
    warning "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif

return
