Solved

VB6 - How to show a Popup Menu while rightclicking a text box?

Posted on 2008-10-30
4
343 Views
Last Modified: 2008-10-30
Hi Experts,

I have a text box that I want to show a popup menu when the user rights click on it. I have tried the code on Mouse_Down like I usually use for the form but it didn't work. It shows the normal popup menu of the text box; the one that has "copy, cut etc..."

Please check my code below. Is there anything missing that I have to set for the textbox?
Private Sub txt_body_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
 
        If Button = vbRightButton Then
           Me.PopupMenu Me.mnu_Main
        End If
        
End Sub

Open in new window

0
Comment
Question by:feesu
[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
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Antagony1960 earned 250 total points
ID: 22839816
One way is to temporarily disable the textbox while displaying the popup.
0
 

Author Comment

by:feesu
ID: 22839833
Is this how all people do??
0
 
LVL 11

Expert Comment

by:Antagony1960
ID: 22839894
Not always, the problem is that you have to overcome the existing context menu. It doesn't display if the control is disabled, but a disabled textbox changes color and the focus jumps away so it's an ugly method. The only other way I know of way is to use the API to hide the default context menu. Check out this solution.
0
 

Author Comment

by:feesu
ID: 22839918
I prefer the simple solution. Thanks.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA filters 2 71
Recommendation vb6 to vb.net or others 14 209
backup program with robocopy 6 74
VBA: loop recent folder and copy txt file. 8 51
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

726 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