!------------------------------------------------------------------------------!
! Tests for LIST2 command autohide (BUG 2058)
!
!   Author : J. bauer
!   Version: $Id: test_list2_autohide.mm,v 1.3 2011/06/13 13:32:55 jwb Exp $
!   Bug:     2058 
!------------------------------------------------------------------------------!

startmacro

  res row {X=2,Y=4}
  res instr "Should see a single row listed with values X=2 and Y=4. &
      Press the 'AddRow' button to add another row of data to the list &
      with values of X=1 and Y=2."
  info "Should see two info messages below. The second should describe the template with X and Y."
 
  pipe init
	  panel/msgid=MAIN/controls=gc/setup
	  
		  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" 24 8 /title
		
		  gcontrol button butt "" "AddRow" none
	  
	  ! Initially list nothing
	  list2/msgid=main/id=idlist template={_GLOBAL_={AUTOHIDE=FALSE}}
	  
	  ! Then add a row 
	  set reg.idlist.addRow row
   
  pipe off

endmacro

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Procedure for handling all messages
procedure processMessage m:msg
  if msg.name EQS "MAIN" then
    if msg.data EQS "EXIT" then
      pipe stop
    else
      assert/text="LIST2 tests" "PASS" SUBS msg.data
      pipe stop
    endif
  elseif msg.name eqs "BUTT" then
    call addRow
  endif  
return
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
procedure addRow
  invoke ,, reg.idlist.addRow({X=1,Y=2})
return