Zachlr Posted April 8, 2009 Author Share Posted April 8, 2009 Sorry if that post was confusing, I'm figuring out new stuff as I type. LOL. But it's all a learning experience right?HiVery interested in this topicSome nice information here. But wondering why this relatively obscure UDF that is not in the helpfile. Why not use_GUICtrlListView_SimpleSortI found it in the function in a third party online help file. I assume it is in the UDF.chm file as well. Link to comment Share on other sites More sharing options...
picea892 Posted April 8, 2009 Share Posted April 8, 2009 Hi again Your examples work, The function works when I transfer it to my script, however the case switch does not work and won't register the click on the header. When you look at the simple sort example it registers the click on the column heading using the following: CODESwitch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) _DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) _GUICtrlListView_SimpleSort($hWndListView, $B_DESCENDING, DllStructGetData($tInfo, "SubItem")) ; No return value So, I'm pretty confused how the below switch in your script works. Case $ListView. That just means the listview is selected doesn't it? CODEWhile 1 Switch GUIGetMsg() ;wait for input Case $GUI_EVENT_CLOSE _GUICtrlListView_UnRegisterSortCallBack($ListView) Exit Case $ListView _GUICtrlListView_SortItems($ListView, GUICtrlGetState($ListView)) ;BOOM! EndSwitch WEnd What am I missing, why doesn't your switch work in my script.....do I need to apply the Case $LVN_COLUMNCLICK Picea Link to comment Share on other sites More sharing options...
Zachlr Posted April 9, 2009 Author Share Posted April 9, 2009 Hi again Your examples work, The function works when I transfer it to my script, however the case switch does not work and won't register the click on the header. When you look at the simple sort example it registers the click on the column heading using the following: CODESwitch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) _DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) _GUICtrlListView_SimpleSort($hWndListView, $B_DESCENDING, DllStructGetData($tInfo, "SubItem")) ; No return value So, I'm pretty confused how the below switch in your script works. Case $ListView. That just means the listview is selected doesn't it? CODEWhile 1 Switch GUIGetMsg() ;wait for input Case $GUI_EVENT_CLOSE _GUICtrlListView_UnRegisterSortCallBack($ListView) Exit Case $ListView _GUICtrlListView_SortItems($ListView, GUICtrlGetState($ListView)) ;BOOM! EndSwitch WEnd What am I missing, why doesn't your switch work in my script.....do I need to apply the Case $LVN_COLUMNCLICK Picea I am not using SimpleSort, instead SortItems. Honestly the SimpleSort function isn't so simple in my opinion. When a header is clicked, GUIGetMsg() will return the control ID of the list view, and from there you can use GUICtrlGetState($ListView) to find out which header was clicked. In fact, $LVN_COLUMNCLICK does not appear at all in my script. If GUIGetMsg() = $ListView Then ;a header was clicked $ListView_HeaderClicked = GUICtrlGetState($ListView) ;find out which one was clicked, the header clicked now equals $ListView_HeaderClicked MsgBox("", "You clicked: " & $ListView_HeaderClicked) EndifoÝ÷ Ù*2¢íýÛhv®¶sevÆR¥7vF6uTvWD×6r·vBf÷"çW@ 66Rb33c´uTôUdTåEô4Äõ4P W@ 66Rb33c´Æ7EfWp ôuT7G&ÄÆ7EfWuõ6÷'DFV×2b33c´Æ7EfWrÂuT7G&ÄvWE7FFRb33c´Æ7EfWr´$ôôÒb333°¤VæE7vF6¥tVæ@ to get which header was clicked. Link to comment Share on other sites More sharing options...
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