Psibernetic Posted February 9, 2010 Posted February 9, 2010 I am having issues trying to detect a doublelclick in a listview control. According to smashly, the issue is with an int in the $tagNMHDR struct not being converted to int64. I need assistance correcting this, whether in the struct or a workaround (other than running 32bit). The following link is to the discussion, few months old now. http://www.autoitscript.com/forum/index.php?showtopic=100148&st=0&p=771136&#entry771136 Some code that only notifies me with a msgbox when I run 32bit: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiListView.au3> $Form1 = GUICreate('boo', 361, 270, 200, 200) ;~ Create listview $hListView = GUICtrlCreateListView( "", 0, 0, 260, 377) ; LEFT],[TOP],WIDTH],[HEIGHT] _GUICtrlListView_SetExtendedListViewStyle ($hListView, BitOR($LVS_AUTOARRANGE,$LVS_EX_FULLROWSELECT,$LVS_EX_DOUBLEBUFFER,$LVS_EX_SUBITEMIMAGES,$LVS_EX_ONECLICKACTIVATE)) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 150) ; Add items _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1) _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE ;~ ======================================================== ;~ This thing is responsible for click events ;~ ======================================================== Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_ITEMACTIVATE ; Sent by a list-view control when the user double-clicks an item with the left mouse button Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $Index = DllStructGetData($tInfo, "Index") $subitemNR = DllStructGetData($tInfo, "SubItem") ; make sure user clicks on the listview & only the activate If $Index <> -1 Then ; col1 ITem index $item = StringSplit(_GUICtrlListView_GetItemTextString($hListView, $Index),'|') $item = $item[1] ;Col item 2 index $item2 = StringSplit(_GUICtrlListView_GetItemTextString($hListView, $subitemNR),'|') $item2= $item2[2] MsgBox(0,"",$item & ' ' & $item2 & @CRLF) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY [sup]Psibernetic[/sup]My Creations:X-HideSecuracy
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