Mouse Click Event

I was wondering how (if possible) I can make a small menu pop up when I right click on an object.  If possible could I please have a small example...thanks
bmanenAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
dreamvbConnect With a Mentor Commented:
This might work for you

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = 2 Then
  PopupMenu Form1.mnuMyMenu
  End If
 
End Sub

hope it help you out.
0
 
MarineCommented:
Do you mean to show a popup menu when you right click on some object ? make a menu with Menu BUilder Set the Parent visible = False . FOr example this uses Command Button when you press right mouse on it it will show a popup menu


Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
    Form1.PopupMenu mnuVal
End If
End Sub
0
 
wsh2Commented:
First, go to this hyperlink to learn how to create a Menu with the Menu Editor (It has graphics so I can't paste it here).

http://msdn.microsoft.com/library/devprods/vs6/vbasic/vbcon98/vbconcreatingmenuswithmenueditor.htm

Second, go to this link to see how to code a Popup Menu to work in conjucnction with with a right mouse click while over a form or a control.

http://msdn.microsoft.com/library/devprods/vs6/vbasic/vbcon98/vbcondisplayingpopupmenus.htm

If you have any questions after that.. feel free to rejoin us again back here.. <smile>.

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
MarineCommented:
This is some clarification what i meant.

Files
....Open
....Close
....Exit

Files has the name of mnuFiles its caption is Files. Set it visible to False. Leave the others as they are. Then in the whatever object Mouse_Down Event. You can use this code. In this example i used Command Button
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
    Form1.PopupMenu mnuFiles
End If
End Sub
0
 
MarineCommented:
I think ws2 you will win . I am low on these resources :(
ANd yes it's better seen on the graphics.
0
 
MarineCommented:
I think ws2 you will win . I am low on these resources :(
ANd yes it's better seen on the graphics.
0
 
MarineCommented:
it does help but please take your answer away we have already covered that option.
0
 
GivenRandyCommented:
Dreamvb, Marine has already answered the question.  Please change your answer to a comment.
0
All Courses

From novice to tech pro — start learning today.