Sign in to follow this  
Followers 0
d0n

clicking a listview

4 posts in this topic

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



#2 ·  Posted (edited)

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
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]
                        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

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
   _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.

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