Solved

Putting Menus on Right Mouse Click in VB 4.0

Posted on 2000-03-21
8
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

628 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