Jump to content

Recommended Posts

Posted (edited)

#include <GuiListView.au3>
#include <GUIConstants.au3>

$Form1 = GUICreate("Test", 300, 200)
$ListView1 = GUICtrlCreateListView("Col1|Col2", 15, 15, 270, 118)
GUICtrlCreateListViewItem("R1C1|R1C2", $ListView1)
GUICtrlCreateListViewItem("R2C1|R2C2", $ListView1)
GUISetState(@SW_SHOW)
 
GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
 
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Func OnDoubleclick()
     $col1 = _GUICtrlListView_GetItemText($ListView1,_GUICtrlListView_GetNextItem($ListView1),0) ; current selected
     If $col1 = -1 Then Return
 
     ConsoleWrite($col1 & @CRLF)
EndFunc  
 
Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
     #forceref $hWndGUI, $MsgID, $wParam
     Local $tagNMHDR, $event
     
     If $wParam = $ListView1 Then
         $tagNMHDR = DllStructCreate("int;int;int", $lParam)
         $event = DllStructGetData($tagNMHDR, 3)
         
         If $event = $NM_DBLCLK Then OnDoubleclick()
     EndIf
EndFunc

Edited by Zedna
Posted (edited)

WOW that Was the fastest help i got,Thanks alot i already tried it with Hit Test thing but failed but this one works thanks alottttttttt!!

Here is little improvement to avoid hits when doubleclicked outside items area:

Func OnDoubleclick()
      $row = _GUICtrlListView_GetNextItem($ListView1) ; current selected
      If $row = -1 Then Return
      $col1 = _GUICtrlListView_GetItemText($ListView1,$row,0)
  
      ConsoleWrite($col1 & @CRLF)
EndFunc

Can u Stop Calling me spammer ^__^

No I can't. It's default forum naming based on your post count :-)

EDIT: But after some post count reached you can change this default to your own.

Edited by Zedna

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...