home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / shareware / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlListViewSetCheckState.au3 < prev    next >
Encoding:
Text File  |  2006-06-20  |  1.7 KB  |  44 lines

  1. #include <GuiConstants.au3>
  2. #include <GuiListView.au3>
  3.  
  4. opt('MustDeclareVars', 1)
  5. Dim $listview, $Btn_Set, $Btn_SetAll, $Btn_Exit, $msg, $Status, $ret
  6. GUICreate("ListView Set Check State", 392, 322)
  7.  
  8. $listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
  9. GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
  10. GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
  11. GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_CHECKBOXES, $LVS_EX_CHECKBOXES)
  12. GUICtrlCreateListViewItem("index 0|data1|more1", $listview)
  13. GUICtrlCreateListViewItem("index 1|data2|more2", $listview)
  14. GUICtrlCreateListViewItem("index 2|data3|more3", $listview)
  15. GUICtrlCreateListViewItem("index 3|data4|more4", $listview)
  16. GUICtrlCreateListViewItem("index 4|data5|more5", $listview)
  17. _GUICtrlListViewSetColumnWidth ($listview, 0, 100)
  18. $Btn_Set = GUICtrlCreateButton("Set Index 2", 150, 200, 90, 25)
  19. $Btn_SetAll = GUICtrlCreateButton("Set All", 150, 230, 90, 25)
  20. $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
  21. Local $check = 1
  22. Local $checkall = 1
  23. GUISetState()
  24. While 1
  25.     $msg = GUIGetMsg()
  26.     Select
  27.         Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
  28.             ExitLoop
  29.         Case $msg = $Btn_SetAll
  30.             Local $ret = _GUICtrlListViewSetCheckState($listview, -1, $checkall)
  31.             $checkall = Not $checkall
  32.             If ($ret == $LV_ERR) Then
  33.                 MsgBox(0, "Error", "Error setting Check state")
  34.             EndIf
  35.         Case $msg = $Btn_Set
  36.             Local $ret = _GUICtrlListViewSetCheckState($listview, 2, $check)
  37.             $check = Not $check
  38.             If ($ret == $LV_ERR) Then
  39.                 MsgBox(0, "Error", "Error setting Check state")
  40.             EndIf
  41.     EndSelect
  42. WEnd
  43. Exit
  44.