Hi guys, I have a problem with this:
I want to click on the first checkbox ( sorry for the [0], in the complete script is an array of checkbox ) and select/deselect all the checkbox
Work if i click slowly...but if i click "fast" the checkbox will not selected![:D]()
How to avoid this behavior? Thanks
[ autoit ]
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> Global $SelALL[1], $Flag = True Example() Func Example() Local $listview, $button, $item1, $item2, $item3, $item4, $item5, $item6, $msg GUICreate("listview items", 220, 250, -1, -1) $iListView = GUICtrlCreateListView("1111111|222222222|33333333", 10, 10, 200, 150, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_CHECKBOXES)) $hListView = GUICtrlGetHandle($iListView) $SelALL[0] = GUICtrlCreateListViewItem("ALL", $iListView) $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $iListView) $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $iListView) $item4 = GUICtrlCreateListViewItem("item3|col32|col33", $iListView) $item5 = GUICtrlCreateListViewItem("item3|col32|col33", $iListView) $item6 = GUICtrlCreateListViewItem("item3|col32|col33", $iListView) $item7 = GUICtrlCreateListViewItem("item3|col32|col33", $iListView) _GUICtrlListView_SetCheckedStates($hListView, 1) ; select all GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If _GUICtrlListView_GetItemChecked($iListView, $SelALL) And $Flag = True Then _GUICtrlListView_SetCheckedStates($hListView, 1) $Flag = False ElseIf Not _GUICtrlListView_GetItemChecked($iListView, $SelALL) And $Flag = False Then _GUICtrlListView_SetCheckedStates($hListView, 0) $Flag = True EndIf WEnd EndFunc ;==>Example Func _GUICtrlListView_SetCheckedStates($hListView, $iType) ; autoitscript.com/w/index.php?title=Snippets_(_Checkboxes_) Local $fState = False, $iCount = _GUICtrlListView_GetItemCount($hListView) If $iType < 0 Or $iType > 2 Then Return SetError(1, 0, 0) EndIf If $iType Then $fState = True EndIf For $i = 0 To $iCount - 1 If $iType = 2 Then $fState = Not _GUICtrlListView_GetItemChecked($hListView, $i) ; Invert checked state with $iType 2. EndIf _GUICtrlListView_SetItemChecked($hListView, $i, $fState) Next EndFunc ;==>_GUICtrlListView_SetCheckedStates
I want to click on the first checkbox ( sorry for the [0], in the complete script is an array of checkbox ) and select/deselect all the checkbox
Work if i click slowly...but if i click "fast" the checkbox will not selected
![:D](http://aut1.autoit-cdn.com/forum/public/style_emoticons/default/biggrin.png)
How to avoid this behavior? Thanks