startmacro
!
!
! Tests the GCONTROL PROMPT widget
! @author  jph, jwb
! @version $Id: test_gcontrol_prompt.mm,v 1.8 2010/12/15 13:26:41 jwb Exp $
!
!

switch INTERACTIVE interAct GET DEF=TRUE
if interAct then

  set L:nChars 4
  set instr "Should see several GPrompt controls. Type in each. The first and second &
             prompt should limit the input to ^nChars characters. The password &
             field text should not display but should be shown in the text box below."
  
  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 TEXT idtext INSTRUCTIONS "^instr" 48 6 /title
         
    gcontrol prompt promptShort     "Limited to ^nChars Chars" "Hi!" ^nChars /flags=+limitChars|+nowarn
    gcontrol prompt promptShortWarn "Limited to ^nChars Chars (w/warnings)" "Hi!" ^nChars /flags=+limitChars
    gcontrol prompt promptLong      "No Char Limit"          "Right Click Here"
    gcontrol prompt promptNoDef     "No Default"            ""
    gcontrol prompt promptPassword  "Password: "          "" 6 /flags=+password
    gcontrol label  textLabel "Password Plain Text"
    gcontrol text   displayPassword PASSWORD "" 20 1

  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 eqss "PROMPTPASSWORD"  then
  !say "Got msg ^msg.name"
  set gc.displayPassword.value gc.promptPassword.value
elseif msg.name eqs "SHOWN"  then
  !Ignore
else
  ! do nothing
  !say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
endif

return

