Solved

EASY - Popup menu in VB6

Posted on 2002-07-01
6
547 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

757 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

22 Experts available now in Live!

Get 1:1 Help Now