Click to See Complete Forum and Search --> : Context Menu on Richtextbox


bill brave
August 20th, 2001, 11:15 PM
On Richtextbox control, when I click right mouse button, default context menu will be displayed.

Please help me that : Can I change default menu ?
If yes, How to do that ?

Thank you in advance.

Cakkie
August 21st, 2001, 01:17 AM
You can't change the default, but there is a workaround. In the MouseUp event of the texbox, check to see if the right button is clicked, then set the Enabled property to false, and then back to true. this way, the popup will not show up, then you can show your own.


private Sub RichTextBox1_MouseUp(Button as Integer, Shift as Integer, x as Single, y as Single)

If Button = 2 then
RichTextBox1.Enabled = false
RichTextBox1.Enabled = true
Popupmenu mnuMyPopup
End If

End Sub




Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

bill brave
August 21st, 2001, 03:37 AM
Your idea is good. Thank you.

But I see that the default menu still shows after my menu.

bill brave
August 21st, 2001, 04:13 AM
I found out this way :

private Sub rtfText_MouseUp(Button as Integer, Shift as Integer, x as Single, y as Single)

If (Button = 2) then
rtfText.AutoVerbMenu = false
PopupMenu mnuMyContext
End If

End Sub





Please comment!