MattHiggs Posted July 20, 2021 Posted July 20, 2021 I wanted to see if I could get some more information as to how I could go about utilizing the extended list view style $LVS_EX_CHECKBOXES. When it is used to create a listview control, one would think that it could be used to select the a list view item, but it doesn't do that. It doesn't appear much of anything. So I am curious as to how I could go about to expand this functionality. For example, is there a notification that fires off when a list view item is checked that I can capture and code some action in response? What would that code look like? Any input would be appreciated.
Subz Posted July 20, 2021 Posted July 20, 2021 Usually I get the Listview row count then loop through and use _GUICtrlListView_GetItemChecked to determine if an item is checked or not. You can add the indexes into a temporary array or apply actions based on whether the function returns true or not.
MattHiggs Posted July 20, 2021 Author Posted July 20, 2021 2 minutes ago, Subz said: Usually I get the Listview row count then loop through and use _GUICtrlListView_GetItemChecked to determine if an item is checked or not. You can add the indexes into a temporary array or apply actions based on whether the function returns true or not. So, to your knowledge, there is no windows message or notification that is generated by the control that can be captured with GUIRegisterMsg?
Subz Posted July 20, 2021 Posted July 20, 2021 Have a look at $LVN_ITEMCHANGED (see _GUICtrlListView_Create) look at the newstate to determine if the item is checked/unchecked. Checked = 8192 Unchecked = 4096
Zedna Posted August 11, 2021 Posted August 11, 2021 As Subz said, I use this simplified test: If "State changed" And NewState <> OldState Then ... GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event $tagNMHDR = DllStructCreate("int;int;int", $lParam) $event = DllStructGetData($tagNMHDR, 3) If $hWndGUI = $Form1 And $wParam = $ListView1 Then ; https://docs.microsoft.com/cs-cz/windows/win32/controls/lvn-itemchanged If $event = $LVN_ITEMCHANGED Then $NMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $lParam) If BitAND(DllStructGetData($NMLISTVIEW, "Changed"), $LVIF_STATE) = $LVIF_STATE And _ DllStructGetData($NMLISTVIEW, "NewState") <> DllStructGetData($NMLISTVIEW, "OldState") Then MyFunction() EndIf EndIf Return $GUI_RUNDEFMSG EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search
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