!------------------------------------------------------------------------------!
! Test DR 506539
!
! Author : J. Czechowski IV
! Version: $Id: test_dr506539.mm,v 1.8 2011/06/03 13:11:31 jwb Exp $
!------------------------------------------------------------------------------!
startmacro s:autosel["OFF"]
  res inst "You should see a LIST. AUTOSELECT is OFF by default. &
            The purpose of this test is to show that mouse clicks do not &
            select (highlight) a row when AUTOSELECT=OFF, but a user can still &
            do so programatically, via the button provided. &
            Click on the various cells and columns. The 'Last Selection' &
            box should always show the last cell/row/column selected."

  pipe init
    panel/msgid=MAIN/id=panel/controls=gc/setup
    list/grid=on/msgid=MAIN/win=pane1/id=idlist apenny AUTOSELECT=^autosel

    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"   ^inst 24 14 /title
    !gcontrol button autosel "Auto Select" "OFF,ON" ^autosel
    gcontrol text  idselect  "Last Selection" "N/A" 24 1 /title

    gcontrol/nc=2 button task "Task" "Select Row 4" none
  pipe off
endmacro


procedure processMessage m:msg
  if msg.fid EQSS "PANEL" and msg.name EQS "TASK" then
    if msg.data EQS "Select Row 4" then
      message send idlist,, "SELECTROW",, "4"
    else
      say "Unhandled message: ^msg"
    endif
    
  elseif msg.name EQS "AUTOSEL" then
    set reg.idlist.autoselect ^msg.data
    
  elseif msg.fid EQS "IDLIST" then
    res txt "^msg.name"

    if msg.name eqs "SELECT" then
      res txt "^txt (TYPE=^msg.data.type &
                     ROW=^msg.data.row &
                     COLUMN=^msg.data.column)"
    endif

    set reg.panel.controls.idselect.value ^txt

  elseif msg.name EQSS "MAIN" then
    assert/text="List with AUTOSEL=^autosel tests" "PASS" SUBS msg.data
    pipe stop

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

return
