gillesg Posted February 7, 2018 Posted February 7, 2018 Hello, I am struggling in merging GUITreeViewEx, Shelltristate and enhancing to handle a third state that means : some items under are selected. I have difficulties handling expand order and key Space (especially when node is collapsed). Here the zip with UDF and and example. The problem I might need some advice to handle : 1- When load Treeview, have a correct settings of the checkbox for a tristate tree 2 - Handle keyboard used for walking in tree Chicken is checked and Steak is unchecked When walking with arrow to Meat, it gets unchecked 3 - When node is collapsed and checked thru keyboard (space) the middle state is possible which should not Here is joined an animated gif showing the 3 problems Thanks for your advices GUITreeview3Ex.zip
Zedna Posted February 7, 2018 Posted February 7, 2018 (edited) You have to catch TVN_ITEMCHANGED notification in WM_NOTIFY event and test NewState/OldState change See here for API reference https://msdn.microsoft.com/en-us/library/windows/desktop/bb773526(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/bb773425(v=vs.85).aspx It's similar to ListView with checkboxes where is LVN_ITEMCHANGED notification event where AutoIt's code looks like this: 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 And $disable_refresh_status = False Then 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 EDIT: Search this forum for TVN_ITEMCHANGED / LVN_ITEMCHANGED for more examples ... Edited February 7, 2018 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
gillesg Posted March 20, 2018 Author Posted March 20, 2018 Hello, I am back with my adaptation to build an UDF for Tristate Treevew that automaticly update itself based on child selection. You can play with GUITreeViewEx_Example_Loop.au3 to get a glimpse. But I encountered a difference between x86 and x64. To noticed the difference (step to reporduce) - select item Meat (with mouse) - use space to select multiple time the value. on x86 the propagation occurs correctly; on x64 you see the three possible state of the check box. I think, I narrow it down to the structure $tagNMTVKEYDOWN. thru x64 it is not correctly populated (vkey is not set). Tell me if I wrong. Any possible fix ? Regards GUITreeViewEXTristate.7z
gillesg Posted March 20, 2018 Author Posted March 20, 2018 Finaly log a bug for structure $tagNMTVKEYDOWN
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