Sign in to follow this  
Followers 0
Jarzyn

WM_NOTIFY for list

7 posts in this topic

#1 ·  Posted

hey, i have a question. I copied this func from an example.

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
    $hWndListView = $g_idListView
    If Not IsHWnd($g_idListView) Then $hWndListView = GUICtrlGetHandle($g_idListView)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
                Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_RCLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ;Return 1 ; not to allow the default processing
                    Return 0 ; allow the default processing
                Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_RDBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint

 

and changed this (on my variable)

$hWndListView = $g_idListView
If Not IsHWnd($g_idListView) Then $hWndListView = GUICtrlGetHandle($g_idListView)

on 

$hWndListView = $oResultList
If Not IsHWnd($hWndListView) Then $hWndListView = GUICtrlGetHandle($hWndListView)

and it doesn't work. All what could i say, Any item i click in ListView returns index -1 or less (subitem number is correct) in DebugPrint

ListView stores file list from ftp server.

PS: sorry for my english


Sorry for my english :)

Share this post


Link to post
Share on other sites



#2 ·  Posted

This is reply from DebugPrint func

!===========================================================
+======================================================
-->Line(1470):  $NM_CLICK
--> hWndFrom:   0x000E04F6
-->IDFrom:  10000
-->Code:    -2
-->Index:   -1
-->SubItem: 2
-->NewState:    0
-->OldState:    740419138
-->Changed: 0
-->ActionX: 0
-->ActionY: 0
-->lParam:  1031
-->KeyFlags:    0
+======================================================

 


Sorry for my english :)

Share this post


Link to post
Share on other sites

#3 ·  Posted

Jarzyn,

If $oResultlist is the variable for the control id of the listview you want to process then try this...

$hWndListView = $oResultList
If Not IsHWnd($oResultList) Then $hWndListView = GUICtrlGetHandle($oResultList)

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#4 ·  Posted

Hey, IMO it's doing the same but i tried and it still doesn't work

I add some informations on the console, looks that should work ...

$WM_NOTIFY -> 78
$hWnd -> 0x00150436
$hMyWindow -> 0x00150436
$iMsg -> 78
$wParam -> 0x00002710
$lParam -> 0x011DF244
$hWndListView -> 0x000D0424
$oResultsList -> 0x000D0424

 


Sorry for my english :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Jarzyn,

This is working for me.  I'm using the notification routine you originally posted changed to reflect my listview...

#include <ListViewConstants.au3>
#include <StructureConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <GuiListView.au3>

Local $Clients = _
        [["1560", "Ben", "Age: 25", "Bla bla...", "Bla bla..."], _
        ["1025", "Somebody", "Age: 14", "Bla bla...", "Bla bla..."], _
        ["9684", "John", "Age: 36", "Bla bla...", "Bla bla..."], _
        ["1002", "Laura", "Age: 15", "Bla bla...", "Bla bla..."], _
        ["1234", "Another guy", "Age: 18", "Bla bla...", "Bla bla..."]]

;Create simple GUI
$Form1 = GUICreate("Select client:", 150, 200)

;Create list of clients
$List_Clients = GUICtrlCreateListView("ID|Name", 10, 10, 130, 200)

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; populate listview columns with ID and NAME
For $i = 0 To UBound($Clients) - 1
    _GUICtrlListView_AddItem($List_Clients, $Clients[$i][0])
    _GUICtrlListView_AddSubItem($List_Clients, $i, $Clients[$i][1], 1)
Next

; distribute column widths evenly to show all data
For $i = 0 To _GUICtrlListView_GetColumnCount($List_Clients)
    _GUICtrlListView_SetColumnWidth($List_Clients, $i, $LVSCW_AUTOSIZE_USEHEADER)
Next

While 1
    Switch GUIGetMsg()
        Case $gui_event_close
            Exit
    EndSwitch

WEnd

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
    $hWndListView = $List_Clients
    If Not IsHWnd($hWndListView) Then $hWndListView = GUICtrlGetHandle($hWndListView)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
                Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_RCLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ;Return 1 ; not to allow the default processing
                    Return 0 ; allow the default processing
                Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_RDBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint

If this still does not work you will need to post the failing code or a runnable reproducer.

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

PFFFF, as always your code is working fine same as an example :P

Tried add libraries that u had and i didn't, but that's not it.

in my script it still doesn't work

this is runnable reproduces cause script has more than 1500 code lines (doesn't work here too)

#include <GUIListView.au3>
#include <ListViewConstants.au3>
#include <StructureConstants.au3>
#include <inet.au3>
#include <Misc.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <array.au3>
#include <file.au3>
#include <crypt.au3>
#include <FTPEx.au3>

Global $iID = 571014
Global $aFiles,$aMyReports,$aReports,$aResult,$hConnect = -1,$oResultsList

Global $__MONTERZY[2][2] = [['id',571014], ['name','My name']]
Global $aAllReports[2][2] = [['571014_060520170940_Bla','aaa'], _
                            ["571014_050520172145_heh_still dosent work :(",'d'] _
]

__DisplayResults()

Func __DisplayResults()
    $hRemoteResults = GUICreate("Results",500,500)
    GUISetFont(12)
    $oInpSearch = GUICtrlCreateInput("Type to search", 10, 15,300,25)
    $oBttSearch = GUICtrlCreateButton("Search",320,15,170,25)
    $oResultsList = _GUICtrlListView_Create($hRemoteResults, "LP|String|Date|Name", 0, 55, 500, 445)
    _GUICtrlListView_SetColumnWidth($oResultsList, 0, 40)
    _GUICtrlListView_SetColumnWidth($oResultsList, 1, 200)
    _GUICtrlListView_SetColumnWidth($oResultsList, 2, 130)
    _GUICtrlListView_SetColumnWidth($oResultsList, 3, 110)
    GUISetState(@SW_SHOW,$hRemoteResults)
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    ;$aAllReports = __GET__ALL__REPORTS()
    If $aAllReports <> -1 Then
        $aMyReports = __GET__MY__REPORTS($aAllReports)
        __Update__List($aMyReports)
    Else
        MsgBox(48,"","Nie mogę się połączyć z serwerem" & @CRLF & "Spróbuj później")
    EndIf
    While 1
        Switch (GUIGetMsg())
            Case -3
                ExitLoop
            Case $oBttSearch
                $searching = GUICtrlRead($oInpSearch)
                If StringStripWS($searching,7) <> "" And $searching <> "Wpisz numer zlecenia, aby wyszukać" Then
                    $aResult = __FIND__REPORT($aAllReports,$searching)
                    If $aResult <> -1 Then
                        __Update__List($aResult)
                    Else
                        MsgBox(32,"","Nie znaleziono zlecenia")
                    EndIf
                EndIf
        EndSwitch
    WEnd
    ;__FTP_Close()
    GUIRegisterMsg($WM_NOTIFY, "")
    GUIDelete($hRemoteResults)
    $hRemoteResults = Null
    $oResultsList = Null
    $hConnect = Null
    Return 1
EndFunc

Func __GET__ALL__REPORTS()
    ;$hConnect = __FTP_Login()
    If $hConnect <> -1 Then
        _FTP_DirSetCurrent($hConnect,"/Tests")
        $aFiles = _FTP_ListToArrayEx($hConnect,2)
        _ArraySort($aFiles,1,0,0,3)
        Return $aFiles
    EndIf
    Return -1
EndFunc

Func __GET__MY__REPORTS($aReports)
    Local $tmp[0]
    For $i = 0 To UBound($aReports)-1
        If StringInStr($aReports[$i][0],$iID) <> 0 Then _ArrayAdd($tmp,StringSplit($aReports[$i][0],".",2)[0])
    Next
    Return $tmp
EndFunc

Func __FIND__REPORT($array,$sText)
    Local $tmp[0]
    For $i = 0 To UBound($array)-1
        If StringInStr($array[$i][0],StringReplace($sText,"/","_")) <> 0 Then _ArrayAdd($tmp,StringSplit($array[$i][0],".",2)[0])
    Next
    If UBound($tmp) == 0 Then Return -1
    Return $tmp
EndFunc

Func __DOWNLOAD__REPORT()

EndFunc

Func __Update__List($array)
    _GUICtrlListView_DeleteAllItems($oResultsList)
    For $i=0 To UBound($array)-1
        $tmp = StringSplit($array[$i],"_",2)
        _GUICtrlListView_AddItem($oResultsList,$i+1)
        _GUICtrlListView_AddSubItem($oResultsList,$i,___Zlecenie($tmp),1)
        _GUICtrlListView_AddSubItem($oResultsList,$i,___Date_Format($tmp[1]),2)
        _GUICtrlListView_AddSubItem($oResultsList,$i,___get_Name($tmp[0]),3)
    Next
EndFunc

Func ___Date_Format($sText)
    $tmp = StringSplit($sText,"",2)
    $date = ""
    For $i=0 To UBound($tmp)-1
        If $i > 0 And Mod($i,2)==0 Then
            If $i == 2 Or $i == 4 Then $date &= "/" & $tmp[$i]
            If $i == 6 Then $date &= $tmp[$i]
            If $i == 8 Then $date &= "   " & $tmp[$i]
            If $i == 10 Then $date &= ":" & $tmp[$i]
        ElseIf $i == 0 Then
            $date &= $tmp[$i]
        Else
            $date &= $tmp[$i]
        EndIf
    Next
    Return $date
EndFunc

Func ___Zlecenie($array)
    $sZL = $array[2]
    For $i = 3 To UBound($array)-1
        $sZL &= "/" & $array[$i]
    Next
    Return $sZL
EndFunc

Func ___get_Name($id)
    For $i = 0 To UBound($__MONTERZY)-1
        If StringInStr($__MONTERZY[$i][1],$id) <> 0 Then Return $__MONTERZY[$i+1][1]
    Next
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
    $hWndListView = $oResultsList
    If Not IsHWnd($hWndListView) Then $hWndListView = GUICtrlGetHandle($hWndListView)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
                Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_RCLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ;Return 1 ; not to allow the default processing
                    Return 0 ; allow the default processing
                Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_RDBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint

 

Edited by Jarzyn

Sorry for my english :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

OK, im sooooo stupid. I got this. :D

In your example you used 

$List_Clients = GUICtrlCreateListView("ID|Name", 10, 10, 130, 200)

instead of this i was using 

$oResultsList = _GUICtrlListView_Create($hRemoteResults, "LP|String|Date|Name", 0, 55, 500, 445)

In GUICtrlCreateListView() it works fine but in my control _GUICtrlListView_Create() was missing the style

_GUICtrlListView_SetExtendedListViewStyle($oResultsList,$LVS_EX_FULLROWSELECT)

now it's working fine and It is not necessary to use WM_NOTIFY :P, Thanks :)

Edited by Jarzyn

Sorry for my english :)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0