Solved

Mouse Click Event

Posted on 2000-05-05
8
233 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:bmanen
8 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2782924
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
 
LVL 14

Expert Comment

by:wsh2
ID: 2782929
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
 
LVL 6

Expert Comment

by:Marine
ID: 2782930
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
 
LVL 6

Expert Comment

by:Marine
ID: 2782933
I think ws2 you will win . I am low on these resources :(
ANd yes it's better seen on the graphics.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 6

Expert Comment

by:Marine
ID: 2782936
I think ws2 you will win . I am low on these resources :(
ANd yes it's better seen on the graphics.
0
 
LVL 4

Accepted Solution

by:
dreamvb earned 200 total points
ID: 2782941
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
 
LVL 6

Expert Comment

by:Marine
ID: 2782945
it does help but please take your answer away we have already covered that option.
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2864506
Dreamvb, Marine has already answered the question.  Please change your answer to a comment.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now