water Posted April 21, 2013 Posted April 21, 2013 No idea. I just can guess that processing all the checkboxes in the ListView takes some time. If you click in the meantime this click seems to get lost. Using the UDF functions is even slower as the use AutoIt themselves compared to the native Listview functions. But the questions is: Why would the user need to click on a control that fast? Another idea would be to disable the "all" checkbox while all other checkboxes are enabled/disabled. When this function has ended enable the "all" checkbox again. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
kylomas Posted April 21, 2013 Posted April 21, 2013 Yes, I see all that, however, the code I modified is within the message loop and runs faster than I can click. When I move the code to be actioned by a control it "looses" clicks and slows way down. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
kylomas Posted April 21, 2013 Posted April 21, 2013 johnmcloud, Final code (stripped out all of the original goobledegook) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> Example() Func Example() Local $ilistview, $msg, $checked_state GUICreate("listview items", 220, 250, -1, -1) $iListView = GUICtrlCreateListView("1111111|222222222|33333333", 10, 10, 200, 150, -1, $LVS_EX_CHECKBOXES) GUICtrlCreateListViewItem("ALL", $iListView) GUICtrlCreateListViewItem("item1|col12|col13", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $checked_state = _GUICtrlListView_GetItemChecked($ilistview,0) _GUICtrlListView_SetItemChecked($ilistview, -1, $checked_state) WEnd EndFunc ;==>Example kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
MouseSpotter Posted April 21, 2013 Posted April 21, 2013 @kylomas: you realise that johnmcloud has found 'one-call-checks-all-fast' solution?
johnmcloud Posted April 22, 2013 Author Posted April 22, 2013 (edited) kylomas, With your last "internal solution" i can check-decheck only the first ( which then check-decheck all other ) but example i can't click on the second checkbox to disable it, so are all blocked except the first and this is not good Can be something like: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> Example() Func Example() Local $ilistview, $msg, $checked_state, $Flag GUICreate("listview items", 220, 250, -1, -1) $ilistview = GUICtrlCreateListView("1111111|222222222|33333333", 10, 10, 200, 150, -1, $LVS_EX_CHECKBOXES) GUICtrlCreateListViewItem("ALL", $ilistview) GUICtrlCreateListViewItem("item1|col12|col13", $ilistview) GUICtrlCreateListViewItem("item3|col32|col33", $ilistview) GUICtrlCreateListViewItem("item3|col32|col33", $ilistview) GUICtrlCreateListViewItem("item3|col32|col33", $ilistview) GUICtrlCreateListViewItem("item3|col32|col33", $ilistview) GUICtrlCreateListViewItem("item3|col32|col33", $ilistview) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If _GUICtrlListView_GetItemChecked($ilistview, 0) And $Flag = True Then _GUICtrlListView_SetItemChecked($ilistview, -1, True) $Flag = False ElseIf Not _GUICtrlListView_GetItemChecked($ilistview, 0) And $Flag = False Then _GUICtrlListView_SetItemChecked($ilistview, -1, False) $Flag = True EndIf WEnd EndFunc ;==>Example I think from my point of view ( i can be wrong, you guys are more expert/better coder then me ) than it's better to use a $flag so it can be check-decheck every elements only one time or in your case the loop verify the status all the time with a increased use of resources ( and you can't select other checkbox ) Thanks Edited April 22, 2013 by johnmcloud
kylomas Posted April 22, 2013 Posted April 22, 2013 johnmcloud,With your last "internal solution" i can check-decheck only the first ( which then check-decheck all other ) but example i can't click on the second checkbox to disable it, so are all blocked except the first and this is not good You are absolutely right...I was addressing the check/uncheck response issue only.I think from my point of view ( i can be wrong, you guys are more expert/better coder then me ) than it's better to use a $flag so it can be check-decheck every elements only one time or in your case the loop verify the status all the time with a increased use of resources ( and you can't select other checkbox )Hopefully you know what you want so do it in whatever way works for you.kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
kylomas Posted April 22, 2013 Posted April 22, 2013 johnmcloud, Followup - I moved the "check/uncheck all" control out of the listview. This seems to work as you expect. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <date.au3> Example() Func Example() Local $ilistview, $msg, $bALL = false, $ckstate = false GUICreate("listview items", 220, 250, -1, -1) $iListView = GUICtrlCreateListView("1111111|222222222|33333333", 10, 10, 200, 150, -1, $LVS_EX_CHECKBOXES) local $all = GUICtrlCreateCheckbox("ALL",10,200) GUICtrlCreateListViewItem("item1|col12|col13", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUICtrlCreateListViewItem("item3|col32|col33", $iListView) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $all $ckstate = not $ckstate $bALL = true EndSwitch if $bALL then $bALL = not $bALL _GUICtrlListView_SetItemChecked($ilistview, -1, $ckstate) endif WEnd EndFunc ;==>Example kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now