Solved

Putting Menus on Right Mouse Click in VB 4.0

Posted on 2000-03-21
8
142 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

734 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