Jump to content

clicking a listview


d0n
 Share

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

Link to comment
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:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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]
                        EndIf

                        For $i = $Startline To $Stopline
                            Local $aMatch = StringRegExp($aLines[$i], $useditem, 1)
                            Select
                                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)
                                    EndIf
                            EndSelect
                        Next
                        ;_Array2DEmptyDel($Array)
                        ;
                        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])
                                EndIf
                            Next
                        Next
                        ;_ArrayDisplay($Array)
                        Msgbox("","",_ArrayToClip($Array))

                        ;ToolTip(_ArrayToString($Array,@CRLF),MouseGetPos(0)+10, MouseGetPos(1))
                        ;MsgBox("","",$Array[DllStructGetData($tInfo, "Index")][0])
                    EndIf
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY
Link to comment
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
   _ArrayDisplay($SomeArray)
  $ShowArray1 = False
 EndIf
Wend
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.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...