Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Box

Status
Not open for further replies.

gamechampionx

Programmer
Jan 26, 2002
14
0
0
CA
How do you eliminate the right-click menu in a textbox? What's the property name?
 
I assume you're trying to modify someone else's code, since it takes some effort to
actually code a popup menu (right click menu). The steps to doing this are:

1) Place the menu as a top level menu item as you normally would using Menu Editor
(say it's called mnuPopupMenu)

2) Place submenus items under this, as usual

3) In the editor, de-select mnuPopupMenu's Visible property (Makes the menu "disappear" from menu bar

4) Use code similar to this over the text box, command button, etc where you want the popup menu to appear

Private Sub cmdPrint_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu mnuPopup ' right mouse click
End Sub

So basically I guess need to look for code similar to above in the mouse_down event sub for the text box.

Hope this helps "It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 

Private Declare Function LockWindowUpdate _
Lib "User32" (ByVal hwndLock As Long) As Long

Private Sub txtInput_MouseDown_
(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
'a disabled TB won't display system context menu
If Button = vbRightButton Then
'avoid disabled control's gray text
LockWindowUpdate txtInput.hWnd
txtInput.Enabled = False
'allow txtInput to become disabled
DoEvents
PopupMenu mnuPUText
txtInput.Enabled = True
LockWindowUpdate 0&
End If
End Sub
Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
I'm drying to not have a menu pop up in a text box when the user right-clicks. Can you turn that of with a property or a simple line of code?
 
I'm drying to not have a menu pop up in a text box when the user right-clicks. Can you turn that off with a property or a simple line of code?
 
I mean simple text box. When you right-click on it, a menu with undo and clipboard functions comes up. I don't want it to.
 
What exactly are you doing? For a popup menu to popup, someone has to write the code for it to; who wrote the code? Where did you get the code? We've all been going around and around for 3 or 4 days now, without really knowing exactly what you (or we) are trying to deal with.

Barring that, I'll try to help once again. Go into your code and look for the procedure below (replace "txtYourTextBox" with the name of the text box you're dealing with, and the "PopupMenu" and "mnuPopup" will be whatever names appear to the right of "If Button = 2"; they'll also be in the Menu Editor):

Sub txtYourTextBox_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu mnuPopup ' right mouse click
End Sub

When you find this procedure, simply delete it. This should eliminate the popup menu.

If you really want to clean up, go into the Menu editor and delete all items from "mnuPopup" down> "It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
Untrue missinglinq. Right-click on a textbox will pop up a system menu with no coding whatsoever, which is what we have been discussing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top