Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

EASY - Popup menu in VB6

Posted on 2002-07-01
6
Medium Priority
?
576 Views
Last Modified: 2010-05-02
Hello everyone. I'm sure this must be an easy one.

I want to create a popup menu, on the right mouse click on a form.

I have looked in the help file and it tells me to create a popup menu using the menu editor. I have tried this, but it just creates a menu at the top of the form (or actually at the top of the main form as I am developing an MDI app).

What must I do to create a popup menu, that does not appear as a regular menu?

Thanks
0
Comment
Question by:DapperDan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7121733
You have to create the menu as normal menu and hide it (set visible of the main part to invisible. The name of the top menu could be for example mnuPopMyForm, and below (indended) the menu items you want to see when using the popup.

Then, on MouseUp of the Form, use this code:
PopupMenu mnuPopMyForm
Using the other parameters of this function, you will be able to influence the position and the behaviour, but the above is the least you need to do

CHeers

0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7121747
-Try this

As you have created the menu in the menu editor. Set its property to Visible=false ie the uncheck the visible property of the main menu

Suppose you have the foll
-Options (id-mnuOptions)
--File (id-mnuFile)
--Open (id mnuOpen)

and then write this...

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

PopupMenu mnuoptions

End Sub
------------------------------

Hope this helps

-priya


0
 

Author Comment

by:DapperDan
ID: 7121784
Thanks, to both of you.

I think you basically said the same thing. It's working now but I have one problem.

As I said earlier, this is an MDI app. Now when I click on a particular subform, it hides the main application menus, and replaces it with an empty menu (as the subform has no visible menus).

Is there a way of stopping the subform from replacing the main application menus? I suppose I could put the same menus into the subform, but this seems a bit sloppy.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 600 total points
ID: 7121815
In VB, this is unfortunately not possible unless you move the menus for the mdi Child forms into an activeX-control which you place onto the form and where you can negociate the menus places.
CHeers
0
 

Author Comment

by:DapperDan
ID: 7121833
OK, thanks. Using ActiveX seems a bit excessive here (:

I'll just have to duplicate the menus.
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7122631
oops, late posting..sorry DapperDan! I  think when I was writing the suggestion, something came up. So when I completed it later(ie after 7 minutes), a similar suggestion was aleady posted.

No probs, Hope you could find a solution to your problem. That's important.

-Priya

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…
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…
Suggested Courses

636 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