DapperDan
asked on
EASY - Popup menu in VB6
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
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
-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
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
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, thanks. Using ActiveX seems a bit excessive here (:
I'll just have to duplicate the menus.
I'll just have to duplicate the menus.
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
No probs, Hope you could find a solution to your problem. That's important.
-Priya
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