!******************************************************************************!
! Tests the GCONTROL ALERT widget
! @author  jph
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct      GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)

if interAct then
  set myInstructions "Press the 'Show Alert' button"

  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 {PASS=GREEN,FAIL=RED}
    gcontrol button doAlert "" "Show Alert"

    gcontrol TEXT idtext INSTRUCTIONS "^myInstructions" 48 5 /title
  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 "DOALERT"  then
  gcontrol/wait/timeout=3 ALERT alert  "" "This should go away in 3 seconds"

else
  ! do nothing
  say "^{reg.main.name}: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
endif

return
