|
-
March 24th, 1999, 09:42 PM
#1
Right-click
I would like to be able to right click on something and put choice in there for the user to pick. For instance, for a order entry program have the user right-click on an item have it bring up a box where they can choose to add or delete that item to their order.
-
March 25th, 1999, 04:45 AM
#2
Re: Right-click
Hi
You need to create a menu for your application / control / form / whatever.
In this case, call it mnuPopup, then add some other menu items below it.
Now on the control you want the menu to popup on, place code similar to the following in the controls_mouseup event :
eg:
Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
PopupMenu mnuPopup
End If
End Sub
Of course - you can make the root menu (mnuPopup) invisible, so that it doesn't appear on the form, but it's sub-items will be visible when you use the above code.
My VBCodeLibrary program at http://www.codeguru.com/vb/articles/1638.shtml demonstrates the use of popupmenus
Regards
Chris Eastwood
Codeguru - the website for developers
http://www.codeguru.com/vb
VBCodeLibrary Program
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
|