How can a right mouse button clicked event distinguished from whether it is
on a item or just on the plain area in the listview?
Re: Mouse click
"Maya" <Maya@mail.com> wrote:
>How can a right mouse button clicked event distinguished from whether it
>on a item or just on the plain area in the listview?
You can make it select an item by using the when you click by writing code
that looks like this
Set listview1.SelectedItem = listview1.ListItems(Item.Index)
then in the mouseup or mousedown events you can test for the mousebutton
that was clicked.
here is an example
'loads the listbox with items
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 100
ListView1.ListItems.Add , , CStr(i)
'selects whichever item is clicked
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Set ListView1.SelectedItem = ListView1.ListItems(Item.Index)
'test the button on the mouse that was clicked
Private Sub ListView1_MouseUp(Button As Integer, Shift As Integer, x As Single,
y As Single)
If Button = vbRightButton Then
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL