Solved

Menu

Posted on 2000-05-17
5
204 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

786 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