|
-
Nov 14th, 2002, 06:18 PM
#1
Thread Starter
Lively Member
Right click for ListView
Hi !
I want to know how can i add an option such when a user will use the "right click" with the mouse on some item in the listview control , i will open some menu bar and the user be able to preform some operation on this item .
ThX .
-
Nov 14th, 2002, 06:53 PM
#2
Fanatic Member
VB Code:
Private Sub ListView1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
'do your thing
End If
End Sub
"Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!
Resistance is futile, you will be compiled . . . Please!
-
Nov 14th, 2002, 07:00 PM
#3
Fanatic Member
do a search for
listview popupmenu
1. you basically create a menu
2. put some code in the mousedown event that checks to see if the right mouse was clicked (button = 2)
3. use the me.popupmenu method to show a menu that you created somewhere.
If you can't find it, I'll give you some sample code.
-
Nov 14th, 2002, 07:19 PM
#4
Lively Member
don't forget that you can use the X and Y pos to HitTest and get the selected list item
- gaffa
-
Nov 14th, 2002, 07:22 PM
#5
Fanatic Member
Make a menu ("like File Edit..etc") but dont make it visible, and then use the code below
VB Code:
Private Sub ListView1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
popUpMenu mnuFile 'opens File menu when u right click
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|