Solved

Menu

Posted on 2000-05-17
5
202 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
Comment Utility
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
Comment Utility
"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
Comment Utility
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
Comment Utility
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
Comment Utility
THANK'S !!!!!!!!!!!!!!!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

20 Experts available now in Live!

Get 1:1 Help Now