startmacro

  pipe init
    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/FLAGS=FIXED/MSG=Y/WW=10/NC=-1 menu delay "Delay" &
!      "Stay Open,Close in 2 Sec,Close in 4 Sec"
    gcontrol label  options   "OPTIONS" AlwaysOpen
    gcontrol menu delay "Delay =" &
      "Stay Open,Close in 2 Sec,Close in 4 Sec" /tleft

    textdisplay/id=tdisp text=""

    message send tdisp,,"APPENDL",,"Testing GAlert's Auto-Close Ability"
    message send tdisp,,"APPENDL",,"---------------------------------------"
    message send tdisp,,"APPENDL",,"  1. Click the 'Stay Open' button."
    message send tdisp,,"APPENDL",,"        An alert should come up and stay up"
    message send tdisp,,"APPENDL",,"        until you click 'OK'."
    message send tdisp,,"APPENDL",,""
    message send tdisp,,"APPENDL",,"  2. Click the 'Close in 2 Sec' button."
    message send tdisp,,"APPENDL",,"       An alert should pop up and then it"
    message send tdisp,,"APPENDL",,"       should automatically close after"
    message send tdisp,,"APPENDL",,"       two seconds."
    message send tdisp,,"APPENDL",,""
    message send tdisp,,"APPENDL",,"  3. Click the 'Close in 4 Sec' button."
    message send tdisp,,"APPENDL",,"       An alert should pop up and then it"
    message send tdisp,,"APPENDL",,"       should automatically close after"
    message send tdisp,,"APPENDL",,"       four seconds."
    message send tdisp,,"APPENDL",,""
    message send tdisp,,"APPENDL",,"  4. Click the 'Close in 4 Sec' button but"
    message send tdisp,,"APPENDL",,"     once the alert comes up immediately"
    message send tdisp,,"APPENDL",,"     click 'OK'."
    message send tdisp,,"APPENDL",,"       This should immediately close the"
    message send tdisp,,"APPENDL",,"       alert."
    message send tdisp,,"APPENDL",,""
    message send tdisp,,"APPENDL",,"  5. If all of the above tests pass, click"
    message send tdisp,,"APPENDL",,"     'PASS' otherwise click 'FAIL'"
  pipe off
endmacro

procedure processMessage m:msg
  if msg.fid eqs "PANEL"
    if msg.name eqs "MAIN" then
      assert/text="GControl /TIMEOUT=t tests." msg.data eqss "PASS"
      pipe stop

    elseif msg.name eqs "DELAY"
      if msg.data eqs "CLOSE IN 2 SEC" then
        set l:delay 2
        set text "This will close in ^delay sec."
      elseif msg.data eqs "CLOSE IN 4 SEC" then
        set l:delay 4
        set text "This will close in ^delay sec."
      else
        set l:delay -1
        set text "This will only close if OK is pressed."
      endif

      gcontrol/temp/timeout=^delay alert alert "" text
    endif
  endif
return
