#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
$Form1 = GUICreate("Form1", 320, 259, 192, 124)
Global $Checkbox1 = GUICtrlCreateCheckbox("Select All Items", 8, 24, 97, 17, BitOR($BS_3STATE,$WS_TABSTOP))
$test = GuiCtrlCreateButton("test all checked", 200, 24, 97, 17)
$ListView1 = GUICtrlCreateListView("Items", 8, 48, 297, 201)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
$ListView1_0 = _GUICtrlListView_AddItem($ListView1,"one")
$ListView1_1 = _GUICtrlListView_AddItem($ListView1,"two")
$ListView1_2 = _GUICtrlListView_AddItem($ListView1,"three")
$ListView1_3 = _GUICtrlListView_AddItem($ListView1,"four")
$ListView1_4 = _GUICtrlListView_AddItem($ListView1,"five")
GUISetState(@SW_SHOW)
Global $allchecked = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $test
If GUICtrlRead($ListView1_0) = $GUI_CHECKED Then
Msgbox(0,"", "")
EndIf
Case $Checkbox1
If GUICtrlRead($Checkbox1) = $GUI_UNCHECKED Then
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
_GUICtrlListView_SetItemChecked($ListView1, $C - 1)
Next
$allchecked = 1
ElseIf GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
_GUICtrlListView_SetItemChecked($ListView1, $C - 1, False)
Next
$allchecked = 0
EndIf
EndSwitch
WEnd
why case $test doesn't work