!******************************************************************************!
! purpose: Test that a GDialog is not allowed to grow larger than its parent
!          panel, when there is adequate space to display everything
!          The situation where the dialog needs to be larger than its parent,
!          just to have everything render, is handled separately.
!
! author : Jeanette McCall
! issue  : NXM-3557
! since  : NeXtMidas 3.9.4
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE SDEF=TRUE

  set diaText "Grab the bottom right corner of this dialog box to expand it.\n\n&
               Try expanding it to be wider or taller than the parent panel\n\n&
               You should not be able to do so.\n\n&
               Finally, click on Apply, Add, and/or Close button."

  set instructions "Follow the instructions in the dialog box\n\n&
                    Click PASS if everything worked as expected."

  if interAct then
    set this.timer(0) 0.1
    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 "^instructions" 24 13 /title

    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 eqs "TIMER" then
    set this.timer(0) 0
    gcontrol/temp/msg=t/handle="DLOG" DIALOG dialog "Dialog Box" 300 3 "Add,Apply,Close" "Add,Apply"
    res dlw reg.DLOG.widgets
    res choices "ITEM1,ITEM2,ITEM3,ITEM4,ITEM5,ITEM6"
    gcontrol/panel=dlog/msg=t text   text  "TextInfo" "^diaText" 30 15
    gcontrol/panel=dlog  prompt testPrompt "Dialog Prompt" "Thanks for testing me!!!"
    invoke ,, dlog.resize(1)

  else
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid"
  endif

return
