Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Get ListView Header Order After Drag/Drop

$
0
0

Hi all,

 

So, I was following the Help file trying to get the resulting column order after dragging a column header in a listview. I can't seem to get the order after the drag as the results I receive are from before. It's rather odd. Is there a way I can get this information using WM_NOTIFY like in the below example?

 

Thanks for the help!

AutoIt         
#include <Array.au3> #include <GUIConstantsEx.au3> #include <GuiHeader.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> Global $g_ListView Example() Func Example()     Local $hGUI     ; Create GUI     $hGUI = GUICreate("Header", 400, 300)     $g_ListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 0, 0, 400, 300, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_INFOTIP, $LVS_REPORT, $LVS_EX_HEADERDRAGDROP))     GUISetState(@SW_SHOW)     GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")     ; Loop until the user exits.     Do     Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc   ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)     #forceref $hWnd, $iMsg, $wParam     Local $hWndFrom, $iCode     Local $tNMHDR, $tNMHEADER, $tNMHDFILTERBTNCLICK, $tNMHDDISPINFO         $hHwnd = GUICtrlGetHandle($g_ListView)     $tNMHDR = DllStructCreate($tagNMHDR, $lParam)     $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))     $iCode = DllStructGetData($tNMHDR, "Code")     Switch $iCode         Case $HDN_ENDDRAG ; Sent by a header control when a drag operation has ended on one of its items             ConsoleWrite("!> " & _GUICtrlListView_GetColumnOrder($g_ListView) & @CRLF); <<<<<<<<<<<<<<< This will return the order BEFORE the drop             Return False ; To allow the control to automatically place and reorder the item     EndSwitch     Return $GUI_RUNDEFMSG EndFunc   ;==>WM_NOTIFY

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>