!******************************************************************************!
! Tests the GCONTROL BUTTON functionality.
!
! @author  J. Czechowski IV
!******************************************************************************!
startmacro nostate[0]
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)

  if interAct then
    pipe on

      panel/msgid=MAIN/setup/controls=gc

      gcontrol label  MACRO "GCONTROL BUTTON TESTS"
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemcolors {PASS=GREEN,FAIL=RED}

      gc label  state  "CONTROLS THAT SHOW STATE WHEN PRESSED"
      gc button state1 "1. Should default to NO button pressed                 " &
                       "A,B,C" /tright
      gc button state2 "2. Should default to NO button pressed (Selected = '' )" &
                       "A,B,C" "" /tright
      gc button state3 "3. Should default to NO button pressed (Selected =  0 )" &
                       "A,B,C" 0 /tright
      gc button state4 "4. Should default to NO button pressed (Selected = 'D')" &
                       "A,B,C" "D" /tright
      gc button state5 "5. Should default to 'A' pressed       (Selected = 'A')" &
                       "A,B,C" "A" /tright
      gc button state6 "6. Should default to 'A' pressed       (Selected =  1 )" &
                       "A,B,C" 1 /tright

      gc label  nostate  "CONTROLS THAT DO NOT SHOW STATE WHEN PRESSED (/NOSTATE IS ON)"
      gc button nostate1 "1. Should default to NO button pressed                 " &
                         "A,B,C" /NOSTATE /tright
      gc button nostate2 "2. Should default to NO button pressed (Selected = '' )" &
                         "A,B,C" "" /NOSTATE /tright
      gc button nostate3 "3. Should default to NO button pressed (Selected =  0 )" &
                         "A,B,C" 0 /NOSTATE /tright
      gc button nostate4 "4. Should default to NO button pressed (Selected = 'D')" &
                         "A,B,C" "D" /NOSTATE /tright
      gc button nostate5 "5. Should default to 'A' pressed       (Selected = 'A')" &
                         "A,B,C" "A" /NOSTATE /tright
      gc button nostate6 "6. Should default to 'A' pressed       (Selected =  1 )" &
                         "A,B,C" 1 /NOSTATE /tright


      gc label  nostate  "CONTROLS THAT DO NOT SHOW STATE WHEN PRESSED (/NODEPRESS IS ON)"
      gc button nostate1 "1. Should default to NO button pressed                 " &
                         "A,B,C" /NODEPRESS /tright
      gc button nostate2 "2. Should default to NO button pressed (Selected = '' )" &
                         "A,B,C" "" /NODEPRESS /tright
      gc button nostate3 "3. Should default to NO button pressed (Selected =  0 )" &
                         "A,B,C" 0 /NODEPRESS /tright
      gc button nostate4 "4. Should default to NO button pressed (Selected = 'D')" &
                         "A,B,C" "D" /NODEPRESS /tright
      gc button nostate5 "5. Should default to NO button pressed (Selected = 'A')" &
                         "A,B,C" "A" /NODEPRESS /tright
      gc button nostate6 "6. Should default to NO button pressed (Selected =  1 )" &
                         "A,B,C" 1 /NODEPRESS /tright

    pipe off
  endif

endmacro

!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "MAIN"
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop
  elseif msg.name eqss "STATE" or msg.name eqss "NOSTATE" then
    say "^{msg.name}: Selected '^{msg.data}'"
  else
    ! do nothing
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif

return
