!******************************************************************************!
! Test the Gcontrol CHOICE widget
!
! @bug      2681  GControl: Suppress tooltips in status bar
! @author:  J Hallam / J Bauer
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE SDEF=TRUE  ! for normal interactive test(s)

  if interAct then
   res wTheme {}
   res wTheme.CWFG    BLUE
   res wTheme.CWTITLE RED

    set myInstructions "The default chosen item for 'CHOICES' should be 'Choice2'. \n\n&
                       Left-click on it and USE THE KEYBOARD ARROW KEYS to select another item. \n\n&
                       Right-click on it to type your own text and use right-click &
                       again to enter your text. \n\n The CHOICES Widget should have a Tool Tip &
                       displayed in the Title Bar (or a Swing Tool Tip if in all-Swing mode). \n\n&
                       Use the prompt to change the text of the CHOICES tool tip.\n\n&
                       Verify that the titles appear in the appropriate placements in the example below."

    set tipText        "Sample Tool Tip Text!!"

    pipe on
      panel/msgid=MAIN/setup/controls=gc

      gcontrol label  macro "MACRO"
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      gcontrol TEXT idtext INSTRUCTIONS "^myInstructions" 48 16 /title
      set gc.main.itemcolors {PASS=GREEN,FAIL=RED}
      gcontrol choice choiceWidget "CHOICES" "Choice1,Choice2,Choice3" "Choice2" /input /tooltip="^tipText"
      gcontrol prompt textPrompt "CHOICES Tool Tip Text:" ^tipText 

      ! since 3.1.1 to test BUG 2015
      gcontrol label  label2 "Verify Title Placements for the below CHOICE controls"
      gcontrol choice choiceWidget1 "ChoiceABCD Title on Top (/TTop)" "ChoiceA,ChoiceB,ChoiceC,ChoiceD" "ChoiceA"  /input /TTop
      gcontrol line line1 "SomeWorthlessText" "BLUE" 5  ,, "CENTER"

      gcontrol choice choiceWidget2 "Choice+- Title on Right (/TRight)" "Choice+,Choice-" "Choice+"  /input /TRight
      gcontrol line line1 "SomeWorthlessText" "BLUE" 5  ,, "CENTER"
      gcontrol choice choiceWidget3 "ChoiceXYZ Title on Bottom (/TBottom)" "ChoiceX,ChoiceY,ChoiceZ" "ChoiceZ"  /input /TBottom
      gcontrol line line1 "SomeWorthlessText" "BLUE" 5  ,, "CENTER"
      gcontrol choice choiceWidget4 "Choice123 Title on Left (/TLeft)" "ChoiceOne,ChoiceTwo,ChoiceThree" "ChoiceTwo"  /input /TLeft
    pipe off
  endif

  %test_gcontrol_choice_remove/interactive=^interAct

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 "CHOICEWIDGET"  then
  assert/text="^reg.main.name: msg data=^msg.name value" "^msg.data" EQS "^gc.choiceWidget.value"

elseif msg.name eqs "TEXTPROMPT" then
  set gc.choiceWidget.toolTipText ^msg.data

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

return

