Search Tools Links Login

Right Click Pop Up Menus, how to

This article discribes how to insert pop up menus. Both right and left click. As well as were the menu is displayed in relation to the mouse pointer

Original Author: Stephen Correll


While making your program, go to the menu editor icon along the top of your screen, and create the desired menu. Click on the Visible check box, so that it is not checked. Go to your code screen. For this example I will just use the form for the object that the menu is associated with. You can do this for all objects. Go to the form and create the sub "Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)" if you want the menu to pop up when you right click use the syntax "if button = 2 then popupmenu test" (where test is the name of your menu). If you want to have the menu displayed when the mouse is clicked, just take out the "if button = 2 then" If you would like the menu to show up everytime you right or left click insted of having to left click to exit it, use the code line "If Button = 2 Then PopupMenu test, 2" the 2 tells the computer were the pop up menu will be displayed in relation to the mouse pointer. For Example if you enter 100 the menu will display above the mouse, if you enter 200 it will be displayed to the left and down from the mouse. I hope this helps you, if it does please take a few seconds and post a review or some kind of feadback. (it is no fun to have 300+ hits and still be un-reviewed.)

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 70 times


Visual Basic 6

Posted: 9/3/2020 3:45:00 PM
Size: 1,691 bytes

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.