Jump to content
Sign in to follow this  

clicking a listview

Recommended Posts


Hi, i am wondering what functions i'll need to do this

what i want to do is click on a listview item and show a tooltip of info, what functions do i need to achieve this?

the closest thing i found was using hover

Share this post

Link to post
Share on other sites

I use the mouse right click to display a context menu or open a window with detail information about the clicked item. See WM_NOTIFY in the _GUICtrlListView_Create example on how to catch $NM_RCLICK.

Edited by water

My UDFs and Tutorials:


Active Directory (NEW 2018-10-19 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki


Share this post

Link to post
Share on other sites

Hi i got it to work kinda, but whenever i click it, it will crash when its trying to _arraydisplay, however if i do a Msgbox to show $aMatch[0] it will work.

i am not sure why the array part is not working

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
;~  Local $tBuffer
    $hWndListView = $hListView1
    If Not IsHWnd($hListView1) Then $hWndListView = GUICtrlGetHandle($hListView1)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    $header = _GUICtrlListView_GetColumn($hListView1, 1)
    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, $ilParam)
                    If $header[5] = "test" Then
                        $sStr = FileRead(@Scriptdir&GUICtrlRead($Combo1))
                        Dim $aLines = StringSplit($sStr, @CRLF, 1)

                        $target = GUICtrlRead($Combo2)

                        Dim $Array[1][2] = [[""]]

                        If $Startline = "Error" OR $Stopline = "Error" Then
                            $Startline = 1
                            $Stopline = $aLines[0]

                        For $i = $Startline To $Stopline
                            Local $aMatch = StringRegExp($aLines[$i], $useditem, 1)
                                Case $aMatch <> 0;<== item used
                                    $place = _ArraySearch($Array, $aMatch[1],0,0,1,0,1,0)
                                    If @error = 6 Then  ;<== Not found, so add new name
                                        _Array2DAdd($Array, $aMatch[0]&"|"&"1")
                                        _ArrayDisplay($Array);<===================================== Crashiing
                                    Else                ;<== Found, so add to existing name
                                        $dmg = $Array[$place][1] + 1
                                        _ArraySwap($Array[$place][1], $dmg)
                        For $a = 2 To UBound($Array)
                            For $b = 0 To UBound($Array)-$a
                                If $Array[$b][1] < $Array[$b+1][1] Then
                                    _ArraySwap($Array[$b][1], $Array[$b+1][1])
                                    _ArraySwap($Array[$b][0], $Array[$b+1][0])

                        ;ToolTip(_ArrayToString($Array,@CRLF),MouseGetPos(0)+10, MouseGetPos(1))
                        ;MsgBox("","",$Array[DllStructGetData($tInfo, "Index")][0])
EndFunc   ;==>WM_NOTIFY

Share this post

Link to post
Share on other sites

It is not a good idea to have anything in a message handler which takes a long time. Perhaps that is why it crashes, especially since the _Array display uses a list view which will cause extra notifications while your handler is waiting for you to respond. It is better to set a variable, say $ShowArray1 = True, and then check that in your main loop.

while 1


  If $ShowArray1 then
  $ShowArray1 = False

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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