Hi,
I have a listView in Report Mode, and I need to run a function when an item is clicked with the right-mouse button.
I can't seem to find a way, as the mousedown event doesn't return the listitem.
Thanks,
Mark
Printable View
Hi,
I have a listView in Report Mode, and I need to run a function when an item is clicked with the right-mouse button.
I can't seem to find a way, as the mousedown event doesn't return the listitem.
Thanks,
Mark
use the ListView.SelectedItem.Index to get the index of the selected item, if there is no item selected it will resturn and error 'Object Variable Not Set' so u must catch this error.
does the hittest method not work in report mode?
you can use this:
Code:Private Sub ListView1_MouseDown(Button As Integer, shift As Integer, x As Single, y As Single)
Dim temp As MSComctlLib.ListItem
If Button = 2 Then
Set temp = ListView1.HitTest(x, y)
If Not temp Is Nothing Then
temp.Selected = True
'-----Your function code here
End If
End If
End Sub
Thanks ATommasi
That did it :)
No problem