Adding new group menu item to right-click menu items

SyntaxEditor for Windows Forms Forum

Posted 10 years ago by Nassim Farhat
Version: 4.0.0276
Avatar
Hello Team,

I have questions concerning the addition of more menu items in the right-click menu of the SE EDITOR:

1- I would like to add a menu group before the "Select All" default item


2- I would like that group to be between 2 horizontal marks just like Undo Redo is.

So far I have the following code snippet created based on another forum :


private void STsyntaxEditor_ContextMenuRequested(object sender, ContextMenuRequestEventArgs e)
        {
            ContextMenu menu = this.STsyntaxEditor.GetDefaultContextMenu();

            MenuItem[] mi;
            mi = new MenuItem[2] { new MenuItem("Item1"), 
                                   new MenuItem("Item2") };
            menu.MenuItems.Add("PopUp Dialogs", mi);
            menu.Show(this.STsyntaxEditor, e.MenuLocation);
            this.STsyntaxEditor.DefaultContextMenuEnabled = false;

        }

But I cannot find an overload for MenuItems.Add that let's me add a MenuItem array at a specific index (inorder to be able to place it before the "Select All" item menu)+ I could not find how to create new groups of menus that will add my item between 2 horizontal marks.

3- Can you tell me how to capture the events when clicked on an item?


Regards
Nassim

Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Nassim,

Maybe use Insert multiple times instead of Add with an array, and insert an item with text "-" for the separator. Use the Click event for handlers.

Please note in the future that all your questions deal with the usage of the native WinForms ContextMenu/MenuItem controls. This SyntaxEditor forum is for questions specifically related to SyntaxEditor only. General WinForms control questions should be posted to the Microsoft WinForms forum instead because they can help you in more detail there. Thanks.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.