Solved

Menu

Posted on 2000-05-17
5
205 Views
Last Modified: 2010-08-05
How can I part of my menu appear on the rigth click event, just like a popup menu ???
0
Comment
Question by:trick_jc
  • 3
5 Comments
 
LVL 9

Expert Comment

by:Ruchi
ID: 2819354
The following code would be used to display the Format menu when the user clicks the right mouse button on any open area of the form:

Private Sub Lable1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
    Me.PopupMenu popFormat
End If
End Sub


Place the code for the PopupMenu method in the MouseDown or MouseUp(((((typically the MouseUp))))) event of the form.

pop-up menu named popFormat

Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
    Me.PopupMenu popFormat
End If
End Sub
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2819358
"How to Mimic WordPerfect-Style 'Popup Button' Menus"
http://www.mvps.org/vbnet/code/menu/wpmnubuttons.htm
0
 
LVL 9

Accepted Solution

by:
Ruchi earned 50 total points
ID: 2819373
If you like to get a tutorial on "Visual Basic Menus"
http://www.vbinformation.com/tut-menu.htm
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2819406
if you want the menu to popup when the user clicks anywhere on the form, use the Form's MouseUp Event.  if you want it to popup only on a specific control, use that controls MouseUp event.  if you want this popup menu to only be visible as a popup, and not show up on your regular menu bar, set the top level menu item's visible property to false. e.g., a menu like this:

File
   Save
   Open
PopUp
   PopupItem1
   popupItem2


set PopUp's visible property to false and it wont show up in your menu bar...but use this code, and it will show its elements on a right click event of the form:

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton Then _
        Me.PopupMenu PopUp
End Sub

also I am using Popup as the name of the menu item as well as its caption.  its the name that you pass to the PopupMenu method
0
 

Author Comment

by:trick_jc
ID: 2819415
THANK'S !!!!!!!!!!!!!!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

856 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