שתף באמצעות


Right click on text box displays a context menu by default.

Question

Monday, December 5, 2016 3:19 AM

I am creating an application that has several text boxes (single line and multiline). When I right click my mouse while in those text boxes I get a context menu that shows the following:

Undo

Cut

Copy

Paste

Delete

Select All

Right to Left Reading Order

Show Unicode control Character

Insert Unicode Control Characters

Open IME (Input Method Editor)

Reconversion

Where can I learn more about how to use this context menu or how to suppress it.  I like the six options but having issues finding material on how to use the remaining options.

Thanks and Semper Fi,

Bill K

All replies (3)

Monday, December 5, 2016 3:40 AM ✅Answered

 To suppress the menu,  you can set the TextBox`s ShortcutsEnabled property to false.

 If you want to only use the Select All command,  you can add a ContextMenuStrip control to the form and set the TextBox`s ContextMenuStrip property to that ContextMenuStrip.  Add a Select All item to it and then use the TextBox.SelectAll method in the click event of the Select All item.

    Private Sub SelectAllToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SelectAllToolStripMenuItem.Click
        TextBox1.SelectAll()
    End Sub

If you say it can`t be done then i`ll try it


Monday, December 5, 2016 3:43 AM

Thanks a million for your answer ironRazerz, it works for me

wlk


Monday, December 5, 2016 3:52 AM

Well to supress it I believe you would set the ContextMenu propert to equal Nothing. TextBox1.ContextMenu = Nothing perhaps.

As far as the ContextMenu used as default for TextBox's and probably other controls I can not find a single link that provides definition for each ContextMenu item. It is a generic ContextMenu inherited from Control I believe.

Right to Left reading order is for Right to Left languages and I suppose sets the TextBox's property for that to RightToLeft. Showing and inserting Unicode Control Characters I have no idea about. I've never tried "Input Method Editor" and don't know about Reconversion.

I may have API code that can remove the last five items from the ContextMenu so they are not displayed when the default ContextMenu is used.

La vida loca