Putting Menus on Right Mouse Click in VB 4.0

Experts,

I'm trying to add a popup menu with a right mouse click in VB 4.0, and don't have a menu editor or the popup sub in VB 4.0....Are there built in functions in VB 4.0 for popups?  Thank you
vbdvlperAsked:
Who is Participating?
 
GordonpCommented:
If VB4 forms dont have the Popupmenu method then you'll need to play about with API calls, and you'll definately be looking at more than 20 points worth of answer.

Gordon
0
 
GordonpCommented:
USe the built in VB Menu Editor

Create a Top Level Menu Entry and set uncheck the visible Check Box.

Then create all the ITems for your popup menu as subitems of this hidden top entry.

then

in the MouseDown Event
check for the right mouse button
and call the forms Popupmenu method passing the toplevel menu entry.

ie

if Button = 2 then
    me.PopupMenu mnuPopoup
end if

GordonP


0
 
vbdvlperAuthor Commented:
Thank you.....this solution works, however...I don't believe VB 4.0 has the function PopupMenu?  is there a way to add a popup menu w/o using the me.PopupMenu function?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
vbdvlperAuthor Commented:
I don't believe VB 4.0 has PopupMenu....
0
 
vbWayneCommented:
'Building a popup menu
 
'1) Use the menu editor and create this menu

     mnuPopUpMenuExample
     ....mnuShowMe
     ....mnuWorks
     ....mnuExit

2) Paste this code into the form window

Private Sub Form_Load()
   
'if you leave the menu invisible on building you don't need this
   'line of code in the form load event

   mnuPopUpMenuExample.Visible = False

End Sub

Private Sub Form_MouseUp(Button As Integer, _
        Shift As Integer, X As Single, Y As Single)
   
  If Button = 2 Then
     'puts popup in the middle of the application form

    PopupMenu mnuPopUpMenuExample, 0, frmMain.ScaleWidth / 3,        frmMain.ScaleHeight / 3
 
End If
   
End Sub


 
0
 
vbdvlperAuthor Commented:
Your first answer works.....i don't have the ability to call PopupMenu function....VB version i'm using doesn't havit....i didn't want to get into api calls for this item....apis here seem like overwork for such a detail.....this version of vb is frustrating to use...the features are limited, and it seems that w/o the popupmenu function...the answer is to have some kind of extra form come up.....i'm working with size constraints here more code means bigger size here......apis mean more debugging and other issues that i'm not ready to deal with here.....thank you....
0
 
GordonpCommented:
No problem,
           Is there any reason your still using VB4 as upgrading to at least VB5 makes loads of things a hell of a lot easier.

Gordon
0
 
vbdvlperAuthor Commented:
backwards compatibility and upgrading an old application to make it seem like it's modern with existing tools.....it makes it complicated...but a tool upgrade would be difficult.....thank you...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.