?
Solved

Can system right-click invoked pop-up menu be disabled?

Posted on 1998-12-04
5
Medium Priority
?
147 Views
Last Modified: 2012-05-04
Is it possible with VB5 to disable the system pop-up menu that appears when right-clicking on a text box?  The Paste option allows the user to circumvent validation in my app.  If not, can an application be instructed to ignore right-mouse clicks?  
0
Comment
Question by:craigdawson
[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
5 Comments
 
LVL 3

Expert Comment

by:traygreen
ID: 1448254
Try this in the mouse down event for the controls in question...

Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   If Button = 2 And Shift = 0 Then
      Button = 0
      MsgBox "Mouse Down"
   End If

End Sub

or put the code in a global routine
Public sub SupressPopup(Button As Integer, Shift As Integer)
   If Button = 2 And Shift = 0 Then
      Button = 0
      MsgBox "Mouse Down"
   End If
end sub

and put ...
Call SupressPopup(Button, Shift) in the mousedown events

0
 

Author Comment

by:craigdawson
ID: 1448255
Popup menu still appears.
0
 
LVL 3

Accepted Solution

by:
traygreen earned 100 total points
ID: 1448256
Are you getting the message "Mouse Down"?  If not you do not have the code in all of the controls.  You need to put the code in each of the controls on which you wish to suppress the popup menu.
Email me your form if you would like and I can take a look and see if there is anything weird going on. (traygreen@hotmail.com)
0
 

Author Comment

by:craigdawson
ID: 1448257
Sorry, I should have been more clear.  It works as long as the msgbox is there but not once that line is removed.  I can't have message boxes popping up on every right-click so I still have no solution.
0
 
LVL 2

Expert Comment

by:BergJC
ID: 1448258
CraigDawson,
    What I've had to do in the past is create my own popup menu and use it in place of the default popup menu. It's usually just a bogus menu item (HELP, for example). To do this, create a menu item, we'll call it mnuTest for this example. Click off "visible", so that it doesn't show in your application. Then you must have at least one subitem, so create a menu item underneath mnuTest called mnuHelp. It must be visible (too bad, too, because that would solve our problem).

Then, in your TextBox MouseDown event, put this:

If Button = 2
    Text1.Enabled = False
    PopupMenu mnuTest
    Text1.Enabled = True
    Text1.SetFocus
End-if

Your new popupmenu will display instead of the default, and it won't have Paste. You'll obviously have to display the help file, or whatever bogus thing you did put on your menu, but it effectively prevents them from using the Paste command, and doesn't look bad. It's an alternative to preventing all right mouse clicks.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Suggested Courses

649 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