!------------------------------------------------------------------------------!
! Tests for setShow in GCONTROL
!
!   Author : Hank Kester
!   Version: $Id: test_gcontrol_setshow.mm,v 1.5 2013/05/02 13:53:44 jwb Exp $
!------------------------------------------------------------------------------!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE SDEF=TRUE

  set instructions "You should be able to show/hide the label via either of the dropdowns."

  if interAct then
    pipe on
      panel/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 text idtext "Instructions" "^instructions" 24 8 /title

      gcontrol choice  state1    "set gc.label4.show(boolean)" "true,false" "true" /tleft
      gcontrol choice  state2    "set gc.label4.show(int)"  "0,1" "1" /tleft

      gcontrol label   hideShowLab   "Label  4" "Open"  /msg=y
      gcontrol prompt  prompt4  "Prompt 4" "Num 4"      /edit=n /tleft
      gcontrol dval    dval4    "DVal   4" 4 -1e9 1e9   /edit=n
    pipe off
  endif
endmacro


! Procedure for handling all messages
procedure processMessage m:msg
  if msg.name EQS "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqs "PASS"
    pipe stop

  elseif msg.name eqs "STATE1" then
    if msg.data eqs "true" then
      set Z:booltrue true
      set gc.HIDESHOWLAB.show booltrue
  else
      set Z:boolfalse false
    set gc.HIDESHOWLAB.show boolfalse
  endif
  call updateDropdowns

  elseif msg.name eqs "STATE2" then
    set gc.HIDESHOWLAB.show ^msg.data
  call updateDropdowns

  else
    ! say "^reg.main.name: Unhandled messagename: ^msg.name from fid: ^msg.fid"
  endif
return

procedure updateDropdowns
  if gc.HIDESHOWLAB.show isTrue then
    set gc.state1.value "true"
    set gc.state2.value "1"
  else
    set gc.state1.value "false"
    set gc.state2.value "0"
  endif
return
