Solved

EASY - Popup menu in VB6

Posted on 2002-07-01
6
549 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
  • 2
  • 2
  • 2
6 Comments
 
LVL 142

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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 150 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vb.net 2008 2 58
MS Date Picker 64 bit 32 bit issue 12 53
Help with retrieving partial value from a column using VB.NET 4 48
MS Access 03, TransferText, decimal places 8 67
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…

813 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

13 Experts available now in Live!

Get 1:1 Help Now