Posted 8 years ago by Mick George - Software Engineer, CNC Software, Inc.
Version: 11.1.0545
Avatar
Hi,

I have a question regarding margins, specifically the default syntax editor margins. I have a number of different context menus that I set based upon the file type that is active in the syntax editor, however, when the user mouse over any of the built in margins, line number for example I want to set the current context menu to null so that there is no context menu displayed but I am having a hard time trying to find where best do this, do you have any recommendations?

I should add that I have been using the following and it seems to work but I am not convinced this is the "proper" way.

editor.ActiveView.VisualElement.ContextMenuOpening += new System.Windows.Controls.ContextMenuEventHandler(this.VisualElement_ContextMenuOpening);

        private void VisualElement_ContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            // Test the source, margins come in loud and clear
            object source = e.Source;


        }
[Modified at 10/20/2011 09:40 AM]

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mick,

I'd recommend that you probably handle the SyntaxEditor.ContextMenuOpening event and do a hit test there (see the Hit Testing QuickStart for a sample or the documentation). That should tell you if you are over a margin or not so that you'll know what to do.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.