Solved

Putting Menus on Right Mouse Click in VB 4.0

Posted on 2000-03-21
8
140 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:vbdvlper
  • 4
  • 3
8 Comments
 
LVL 3

Expert Comment

by:Gordonp
ID: 2640067
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
 

Author Comment

by:vbdvlper
ID: 2640100
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
 

Author Comment

by:vbdvlper
ID: 2640103
I don't believe VB 4.0 has PopupMenu....
0
Technology Partners: 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!

 
LVL 1

Expert Comment

by:vbWayne
ID: 2640149
'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
 
LVL 3

Accepted Solution

by:
Gordonp earned 20 total points
ID: 2640167
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
 

Author Comment

by:vbdvlper
ID: 2640198
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
 
LVL 3

Expert Comment

by:Gordonp
ID: 2640230
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
 

Author Comment

by:vbdvlper
ID: 2640265
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

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

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

713 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