Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Creating Pop-Up Menus by right clicking


Reply
 
Thread Tools Display Modes
  #1  
Old 07-30-2004, 02:39 AM
chunk78 chunk78 is offline
Newcomer
 
Join Date: Jan 2004
Posts: 19
Question Creating Pop-Up Menus by right clicking


I'm a complete novice when it comes to VB so any help you can provide would be appreciated.

Don't know if you need to know this but I'm currently using VB6 and have decided to create a Football Pools Prediction Program. Anyway one of the things I would like to do is everytime you rightclick on a label(containing a Teams Name) I would like a pop-up menu to appear with a few options to look at other parts of the program. Basically the pop-up menu that appears every time you rightclick in any windows based application.

Any help would be gratefully received

Many Thanks

Craig
Reply With Quote
  #2  
Old 07-30-2004, 03:06 AM
pikzel_R pikzel_R is offline
Contributor

* Expert *
 
Join Date: Jul 2004
Posts: 484
Default Pop-Up menu Tutorial

Quote:
Originally Posted by chunk78
I'm a complete novice when it comes to VB so any help you can provide would be appreciated.

Anyway one of the things I would like to do is everytime you rightclick on a label(containing a Teams Name) I would like a pop-up menu to appear with a few options to look at other parts of the program. Basically the pop-up menu that appears every time you rightclick in any windows based application
PopupMenu method
Your menus don't have to be located in the menu bar. With the PopupMenu method, you can make a menu appear anywhere on the form. You can also make the menu appear upon right-clicking the mouse. First, decide if you want the menu to only be visible when it pops up, or visible in the menu bar as well. If you don't want the menu in the menu bar, just set the menu title's Visible property to False. Let's say you want a menu to pop up when the user right-clicks or left-clicks on the form.

Private Sub Form_Click( )
PopupMenu mnuPopup, vbPopupMenuRightButton
End Sub

To make the menu respond to only a right-click, use the MouseDown event instead and inspect the Button argument.

from this page:
http://www.officecomputertraining.co...ges/page15.asp

And here's a sample:
Attached Files
File Type: zip PopUp_RightClick_on_Label_Example.zip (1.5 KB, 15 views)

Last edited by pikzel_R; 07-30-2004 at 03:12 AM.
Reply With Quote
  #3  
Old 07-30-2004, 04:07 AM
dwall dwall is offline
Junior Contributor
 
Join Date: Aug 2003
Location: England
Posts: 377
Default

Quote:
To make the menu respond to only a right-click, use the MouseDown event instead and inspect the Button argument.
:
I found the MousUp event preferrable because when you apply the same logic to the likes of a listview for example the mouseup event is triggered after the item has been selected / highlighted
__________________
Its the little things you never knew you did't know until you know them that make the difference
Reply With Quote
  #4  
Old 07-30-2004, 04:40 AM
chunk78 chunk78 is offline
Newcomer
 
Join Date: Jan 2004
Posts: 19
Default

Thanks Both. I'll give this a try
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->