Creating Pop-Up Menus by right clicking

chunk78
07-30-2004, 02:39 AM
I'm a complete novice when it comes to VB so any help you can provide would be appreciated.

Don't know if you need to know this but I'm currently using VB6 and have decided to create a Football Pools Prediction Program. Anyway one of the things I would like to do is everytime you rightclick on a label(containing a Teams Name) I would like a pop-up menu to appear with a few options to look at other parts of the program. Basically the pop-up menu that appears every time you rightclick in any windows based application.

Any help would be gratefully received

Many Thanks

Craig

pikzel_R
07-30-2004, 03:06 AM
I'm a complete novice when it comes to VB so any help you can provide would be appreciated.

Anyway one of the things I would like to do is everytime you rightclick on a label(containing a Teams Name) I would like a pop-up menu to appear with a few options to look at other parts of the program. Basically the pop-up menu that appears every time you rightclick in any windows based application

PopupMenu method
Your menus don't have to be located in the menu bar. With the PopupMenu method, you can make a menu appear anywhere on the form. You can also make the menu appear upon right-clicking the mouse. First, decide if you want the menu to only be visible when it pops up, or visible in the menu bar as well. If you don't want the menu in the menu bar, just set the menu title's Visible property to False. Let's say you want a menu to pop up when the user right-clicks or left-clicks on the form.

Private Sub Form_Click( )
PopupMenu mnuPopup, vbPopupMenuRightButton
End Sub

To make the menu respond to only a right-click, use the MouseDown event instead and inspect the Button argument.

from this page:
http://www.officecomputertraining.com/vbtutorial/tutpages/page15.asp

And here's a sample:

dwall
07-30-2004, 04:07 AM
To make the menu respond to only a right-click, use the MouseDown event instead and inspect the Button argument.
:

I found the MousUp event preferrable because when you apply the same logic to the likes of a listview for example the mouseup event is triggered after the item has been selected / highlighted

chunk78
07-30-2004, 04:40 AM
Thanks Both. I'll give this a try

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum