Adding new group menu item to right-click menu items

SyntaxEditor for Windows Forms Forum

Posted 15 years ago by Nassim Farhat
Version: 4.0.0276
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?


Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
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 (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.