Sign in to follow this  
Followers 0
lsakizada

Unable to create contextmenu to ListView control

5 posts in this topic

#1 ·  Posted (edited)

Hi, I am unable to create proper contextmenu to ListView control.

The contextmenu does not working on the ListView Control with latest beta.

Please help me to create contextmenu on the listview control.

You can use the examples of the beta for the Internal/External examples.

I have tried it with the following code without successful

;$hListView = _GUICtrlListView_Create($GUI, "", $aiSize[0] - 185,70, 170,$aiSize[1] -120)
    $hListView = GUICtrlCreateListView("", $aiSize[0] - 185,70, 170,$aiSize[1] -120)
    _GUICtrlListView_SetExtendedListViewStyle ($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES,$LVS_EX_REGIONAL))
    
    $contextmenu    = GUICtrlCreateContextMenu ($hListView)
    $newsubmenu     = GUICtrlCreateMenu ("new", $contextmenu)
    $textitem       = GUICtrlCreateMenuitem ("text", $newsubmenu)

    $fileitem       = GUICtrlCreateMenuitem ("Open", $contextmenu)
    $saveitem       = GUICtrlCreateMenuitem ("Save", $contextmenu)
    GUICtrlCreateMenuitem ("", $contextmenu); separator

    $infoitem       = GUICtrlCreateMenuitem ("Info", $contextmenu)
    $contextmenu    = GUICtrlCreateContextMenu ($hListView)
Edited by lsakizada

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites



Hi, I know you said using the latest beta 3.2.9.14 ?, but using AutoIt v3.2.10.0 (which is a newer release date) and internal Listview control works with context menus for me.. Maybe it's time to update

#include<GuiConstants.au3>
#Include<GuiListView.au3>

Global $State

$Gui = GUICreate("Test", 200, 200)
$ListView = GUICtrlCreateListView("Items", 5, 5, 190, 190)
_GUICtrlListView_SetExtendedListViewStyle ($ListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES,$LVS_EX_REGIONAL))
_GUICtrlListView_SetColumnWidth($ListView, 0, 90)
$Context0 = GUICtrlCreateContextMenu($ListView)
$Context1 = GUICtrlCreateMenuItem("Add New Item", $Context0)
$Context2 = GUICtrlCreateMenu("Delete", $Context0)
$Context3 = GUICtrlCreateMenuItem("Delete Checked Items", $Context2)
$Context4 = GUICtrlCreateMenuItem("Delete UnChecked Items", $Context2)
GUICtrlCreateMenuItem("", $Context2)
$Context5 = GUICtrlCreateMenuItem("Delete All Items", $Context2)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Context1
            GUICtrlCreateListViewItem("New Item " & _GUICtrlListView_GetItemCount($ListView) + 1, $ListView)
        Case $Context3
            Local $ChkID = ""
            For $i = 0 To _GUICtrlListView_GetItemCount($ListView) -1
                If _GUICtrlListView_GetItemChecked($ListView, $i) Then $ChkID &= _GUICtrlListView_GetItemParam($ListView, $i) & "|"
            Next
            If StringTrimRight($ChkID, 1) <> "" Then
                Dim $SP = StringSplit(StringTrimRight($ChkID, 1), "|")
                For $i = 1 To $SP[0]
                    GuiCtrlDelete($SP[$i])
                Next
            EndIf
        Case $Context4
            Local $ChkID = ""
            For $i = 0 To _GUICtrlListView_GetItemCount($ListView) -1
                If Not _GUICtrlListView_GetItemChecked($ListView, $i) Then $ChkID &= _GUICtrlListView_GetItemParam($ListView, $i) & "|"
            Next
            If StringTrimRight($ChkID, 1) <> "" Then
                Dim $SP = StringSplit(StringTrimRight($ChkID, 1), "|")
                For $i = 1 To $SP[0]
                    GuiCtrlDelete($SP[$i])
                Next
            EndIf
        Case $Context5
            Do
                GuiCtrlDelete(_GUICtrlListView_GetItemParam($ListView, 0))
            Until _GUICtrlListView_GetItemCount($ListView) = 0
    EndSwitch
    DisEnDel()
WEnd

Func DisEnDel()
    If Not _GUICtrlListView_GetItemCount($ListView) And $State = 0 Then
        $State = 1
        For $i = $Context2 To $Context5
            GUICtrlSetState($i, $GUI_DISABLE)
        Next
    ElseIf _GUICtrlListView_GetItemCount($ListView) > 0 And $State = 1 Then
        $State = 0
        For $i = $Context2 To $Context5
            GUICtrlSetState($i, $GUI_ENABLE)
        Next
    EndIf
EndFunc

Sorry about the over blown example , but I thought it's better than post something you can't run..

Cheers

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi, I know you said using the latest beta 3.2.9.14 ?, but using AutoIt v3.2.10.0 (which is a newer release date) and internal Listview control works with context menus for me.. Maybe it's time to update

#include<GuiConstants.au3>
#Include<GuiListView.au3>

Global $State

$Gui = GUICreate("Test", 200, 200)
$ListView = GUICtrlCreateListView("Items", 5, 5, 190, 190)
_GUICtrlListView_SetExtendedListViewStyle ($ListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES,$LVS_EX_REGIONAL))
_GUICtrlListView_SetColumnWidth($ListView, 0, 90)
$Context0 = GUICtrlCreateContextMenu($ListView)
$Context1 = GUICtrlCreateMenuItem("Add New Item", $Context0)
$Context2 = GUICtrlCreateMenu("Delete", $Context0)
$Context3 = GUICtrlCreateMenuItem("Delete Checked Items", $Context2)
$Context4 = GUICtrlCreateMenuItem("Delete UnChecked Items", $Context2)
GUICtrlCreateMenuItem("", $Context2)
$Context5 = GUICtrlCreateMenuItem("Delete All Items", $Context2)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Context1
            GUICtrlCreateListViewItem("New Item " & _GUICtrlListView_GetItemCount($ListView) + 1, $ListView)
        Case $Context3
            Local $ChkID = ""
            For $i = 0 To _GUICtrlListView_GetItemCount($ListView) -1
                If _GUICtrlListView_GetItemChecked($ListView, $i) Then $ChkID &= _GUICtrlListView_GetItemParam($ListView, $i) & "|"
            Next
            If StringTrimRight($ChkID, 1) <> "" Then
                Dim $SP = StringSplit(StringTrimRight($ChkID, 1), "|")
                For $i = 1 To $SP[0]
                    GuiCtrlDelete($SP[$i])
                Next
            EndIf
        Case $Context4
            Local $ChkID = ""
            For $i = 0 To _GUICtrlListView_GetItemCount($ListView) -1
                If Not _GUICtrlListView_GetItemChecked($ListView, $i) Then $ChkID &= _GUICtrlListView_GetItemParam($ListView, $i) & "|"
            Next
            If StringTrimRight($ChkID, 1) <> "" Then
                Dim $SP = StringSplit(StringTrimRight($ChkID, 1), "|")
                For $i = 1 To $SP[0]
                    GuiCtrlDelete($SP[$i])
                Next
            EndIf
        Case $Context5
            Do
                GuiCtrlDelete(_GUICtrlListView_GetItemParam($ListView, 0))
            Until _GUICtrlListView_GetItemCount($ListView) = 0
    EndSwitch
    DisEnDel()
WEnd

Func DisEnDel()
    If Not _GUICtrlListView_GetItemCount($ListView) And $State = 0 Then
        $State = 1
        For $i = $Context2 To $Context5
            GUICtrlSetState($i, $GUI_DISABLE)
        Next
    ElseIf _GUICtrlListView_GetItemCount($ListView) > 0 And $State = 1 Then
        $State = 0
        For $i = $Context2 To $Context5
            GUICtrlSetState($i, $GUI_ENABLE)
        Next
    EndIf
EndFunc

Sorry about the over blown example , but I thought it's better than post something you can't run..

Cheers

Well I am running version 3.2.9.3 and seems that your code is works as well as on my beta.

Please check it with the examples code for the method "_GUICtrlListView_FindInText" in the Help file.

It is not working well. You will get the context menu on the top item (title one) only!

Edited by lsakizada

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

Hi,

I don't see a problem with _GUICtrlListView_FindInText() it does what it's meant to for me.

In the example I wrote if I add 3 items and Search for the text "Item" then of coarse it's going to always return the first instance of the word (Index 0).

But If I search for the text "m 3" then it will only find 1 instance and return Index 2.

If your wanting it to find all instances of matching text in the listview then you'll need to loop the function with a count.

Please show an example of what you mean.

It makes it easier for me to see what your referring to instead of me guessing what your after.

Cheers

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi,

I don't see a problem with _GUICtrlListView_FindInText() it does what it's meant to for me.

In the example I wrote if I add 3 items and Search for the text "Item" then of coarse it's going to always return the first instance of the word (Index 0).

But If I search for the text "m 3" then it will only find 1 instance and return Index 2.

If your wanting it to find all instances of matching text in the listview then you'll need to loop the function with a count.

Please show an example of what you mean.

It makes it easier for me to see what your referring to instead of me guessing what your after.

Cheers

Here is an example for the problem:

When I am using "GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

" then it is not working. If this line is commented then it is working well.

How to make it works with the "GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

"

I meant the problem is with the contextmenu

#include <GuiConstants.au3>
#include <GuiListView.au3>


$Debug_LV = False 

Global $hListView

GUICreate("(Internal) ListView Get Item Text", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
    
_GUICtrlListView_SetExtendedListViewStyle ($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES,$LVS_EX_REGIONAL))
_GUICtrlListView_SetColumnWidth($hListView, 0, 90)
$Context0 = GUICtrlCreateContextMenu($hListView)
$Context1 = GUICtrlCreateMenuItem("Add New Item", $Context0)
$Context2 = GUICtrlCreateMenu("Delete", $Context0)
$Context3 = GUICtrlCreateMenuItem("Delete Checked Items", $Context2)
$Context4 = GUICtrlCreateMenuItem("Delete UnChecked Items", $Context2)
GUICtrlCreateMenuItem("", $Context2)
$Context5 = GUICtrlCreateMenuItem("Delete All Items", $Context2)
GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    
    
    _GUICtrlListView_AddColumn ($hListView, "Items", 100)

    
    _GUICtrlListView_AddItem ($hListView, "Item 1")
    _GUICtrlListView_AddItem ($hListView, "Item 2")
    _GUICtrlListView_AddItem ($hListView, "Item 3")

    
    _GUICtrlListView_SetItemText ($hListView, 1, "New Item 2")
    
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()


Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
    $hWndListView = $hListView
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
;~              Case $LVN_BEGINDRAG; A drag-and-drop operation involving the left mouse button is being initiated
;~                  Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~                  _DebugPrint("$LVN_BEGINDRAG" & @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"))
;~          ; No return value
;~              Case $LVN_BEGINLABELEDIT; Start of label editing for an item
;~                  Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~                  _DebugPrint("$LVN_BEGINLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~                          "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~                          "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~                          "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~                          "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~                          "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~                          "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~                          "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~                          "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~                          "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~                          "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~                  Return False; Allow the user to edit the label
;~          ;Return True; Prevent the user from editing the label
;~              Case $LVN_BEGINRDRAG; A drag-and-drop operation involving the right mouse button is being initiated
;~                  Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~                  _DebugPrint("$LVN_BEGINRDRAG" & @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"))
;~          ; No return value
;~              Case $LVN_BEGINSCROLL; A scrolling operation starts, Minium OS WinXP
;~                  Local $tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam)
;~                  _DebugPrint("$LVN_BEGINSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->DX:" & @TAB & DllStructGetData($tInfo, "DX") & @LF & _
;~                          "-->DY:" & @TAB & DllStructGetData($tInfo, "DY"))
;~          ; No return value
                Case $LVN_COLUMNCLICK; A column was clicked
                    Local $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"))
            ; No return value
;~              Case $LVN_DELETEALLITEMS; All items in the control are about to be deleted
;~                  Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~                  _DebugPrint("$LVN_DELETEALLITEMS" & @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"))
;~                  Return True; To suppress subsequent $LVN_DELETEITEM messages
;~          ;Return False; To receive subsequent $LVN_DELETEITEM messages
;~              Case $LVN_DELETEITEM; An item is about to be deleted
;~                  Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~                  _DebugPrint("$LVN_DELETEITEM" & @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"))
;~          ; No return value
;~              Case $LVN_ENDLABELEDIT; The end of label editing for an item
;~                  Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~                  Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~                  _DebugPrint("$LVN_ENDLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~                          "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~                          "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~                          "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~                          "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~                          "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~                          "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~                          "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~                          "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~                          "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~                          "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~                          "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~                          "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~          ; If Text is not empty, return True to set the item's label to the edited text, return false to reject it
;~          ; If Text is empty the return value is ignored
;~                  Return True
;~              Case $LVN_ENDSCROLL; A scrolling operation ends, Minium OS WinXP
;~                  Local $tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam)
;~                  _DebugPrint("$LVN_ENDSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->DX:" & @TAB & DllStructGetData($tInfo, "DX") & @LF & _
;~                          "-->DY:" & @TAB & DllStructGetData($tInfo, "DY"))
;~          ; No return value
;~              Case $LVN_GETDISPINFO; Provide information needed to display or sort a list-view item
;~                  Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~                  Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~                  _DebugPrint("$LVN_GETDISPINFO" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~                          "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~                          "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~                          "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~                          "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~                          "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~                          "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~                          "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~                          "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~                          "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~                          "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~                          "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~                          "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~          ; No return value
;~              Case $LVN_GETINFOTIP; Sent by a large icon view list-view control that has the $LVS_EX_INFOTIP extended style
;~                  Local $tInfo = DllStructCreate($tagNMLVGETINFOTIP, $ilParam)
;~                  Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~                  _DebugPrint("$LVN_GETINFOTIP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags") & @LF & _
;~                          "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~                          "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~                          "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~                          "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~                          "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam"))
;~          ; No return value
;~              Case $LVN_HOTTRACK; Sent by a list-view control when the user moves the mouse over an item
;~                  Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~                  _DebugPrint("$LVN_HOTTRACK" & @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"))
;~                  Return 0; allow the list view to perform its normal track select processing.
;~          ;Return 1; the item will not be selected.
;~              Case $LVN_INSERTITEM; A new item was inserted
;~                  Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~                  _DebugPrint("$LVN_INSERTITEM" & @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"))
;~          ; No return value
;~              Case $LVN_ITEMACTIVATE; Sent by a list-view control when the user activates an item
;~                  Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
;~                  _DebugPrint("$LVN_ITEMACTIVATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @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 & _
;~                          "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
;~                          "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;~                  Return 0
;~              Case $LVN_ITEMCHANGED; An item has changed
;~                  Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~                  _DebugPrint("$LVN_ITEMCHANGED" & @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"))
;~          ; No return value
;~              Case $LVN_ITEMCHANGING; An item is changing
;~                  Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~                  _DebugPrint("$LVN_ITEMCHANGING" & @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"))
;~                  Return True; prevent the change
;~          ;Return False; allow the change
                Case $LVN_KEYDOWN; A key has been pressed
                    Local $tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
                    _DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode & @LF & _
                            "-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
                            "-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
            ; No return value
;~              Case $LVN_MARQUEEBEGIN; A bounding box (marquee) selection has begun
;~                  _DebugPrint("$LVN_MARQUEEBEGIN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode)
;~                  Return 0; accept the message
;~          ;Return 1; quit the bounding box selection
;~              Case $LVN_SETDISPINFO; Update the information it maintains for an item
;~                  Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~                  Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~                  _DebugPrint("$LVN_SETDISPINFO" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~                          "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~                          "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~                          "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~                          "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~                          "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~                          "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~                          "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~                          "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~                          "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~                          "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~                          "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~                          "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~          ; No return value
                Case $NM_CLICK; Sent by a list-view control when the user clicks an item with the left mouse button
                    Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode & @LF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @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 & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
                            "-->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
                    Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    _DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode & @LF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @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 & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
            ; No return value
;~              Case $NM_HOVER; Sent by a list-view control when the mouse hovers over an item
;~                  _DebugPrint("$NM_HOVER" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode)
;~                  Return 0; process the hover normally
;~          ;Return 1; prevent the hover from being processed
                Case $NM_KILLFOCUS; The control has lost the input focus
                    _DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
            ; No return value
                Case $NM_RCLICK; Sent by a list-view control when the user clicks an item with the right mouse button
                    Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    _DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode & @LF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @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 & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
                            "-->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
                    Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    _DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode & @LF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @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 & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
            ; No return value
                Case $NM_RETURN; The control has the input focus and that the user has pressed the ENTER key
                    _DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
            ; No return value
                Case $NM_SETFOCUS; The control has received the input focus
                    _DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
            ; No return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @LF & _
            "+======================================================" & @LF & _
            "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
            "+======================================================" & @LF)
EndFunc ;==>_DebugPrint
Edited by lsakizada

Be Green Now or Never (BGNN)!

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