Click to See Complete Forum and Search --> : list view


vin
October 15th, 2001, 01:45 AM
Hi,

Given a listview, how can I catch the right-click on a certain item only, not the whole listview area.

Thanks

Valery Iskarov Nikolov
Software Dynamics

Cimperiali
October 15th, 2001, 02:55 AM
'this works if you do not put a breackpoint in Mousedown
'event (or it will prevent the triggering of itemClick event!)
'Do not show msgboxes (or modal forms) in mousedown, too!
option Explicit
Dim intMouse as Integer
private Sub Command1_Click()
Dim i as Integer
With ListView1
for i = 1 to 10

.ListItems.Add , "a" & i, "a" & i

next i
End With
End Sub

private Sub ListView1_ItemClick(byval Item as MSComctlLib.ListItem)

If intMouse = 2 then
Debug.print Item.Key & " right-cliclked!"
End If
End Sub

private Sub ListView1_MouseDown(Button as Integer, Shift as Integer, x as Single, y as Single)
intMouse = Button
End Sub





Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater

vin
October 15th, 2001, 03:13 AM
Special thanks to you, too !

Valery Iskarov Nikolov
Software Dynamics

Cimperiali
October 15th, 2001, 04:18 AM
;-)
Have a nice day, Vin.



Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater