Solved

Putting Menus on Right Mouse Click in VB 4.0

Posted on 2000-03-21
8
136 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
Comment Utility
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
Comment Utility
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
Comment Utility
I don't believe VB 4.0 has PopupMenu....
0
 
LVL 1

Expert Comment

by:vbWayne
Comment Utility
'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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Accepted Solution

by:
Gordonp earned 20 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now