We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How To Supress ContextMenu On Certain Nodes

Thread ID:





35981 Oct 18,2005 01:30 AM UTC Oct 18,2005 12:51 PM UTC WinForms 1
Tags: Tools
Tim Harrington
Asked On October 18, 2005 01:30 AM UTC

Below is a snippet of code from a popup menu on a syncfusion treeview. The problem is that I cannot consistently prevent the menu from coming up. If I go the node where I AM allowing the popup to come up and right click on it, then the menu comes up as you would expect. The problem is that when I the point to another node and quickly right click on it and do not expect the menu to come up, then it still continues to come up. The problem is that the treeview does not have the correct value as its SelectedNode (it continues to hold the value from the original node). Im filtering by the tag on the node and this should work with no problems, but there seems to be a bug with the selectednode value when consistently right clicking on the mouse and pointing to different nodes. Does anyone have a better idea on how to supress the menu for certain nodes? private void contextMenu2_Popup(object sender, System.EventArgs e) { this.rightMouseDownNodeCached = this.tvLeads.RMouseDownNode; // This will be null if the user clicked in the empty portion of the tree. if(this.tvLeads.RMouseDownNode == null) { this.editItem2.Visible = false; this.pasteItem2.Visible = false; this.deleteItem2.Visible = false; } else { if(tvLeads.SelectedNode.Tag == "somevalue") { this.editItem2.Visible = true; this.pasteItem2.Visible = true; this.deleteItem2.Visible = true; } else { this.editItem2.Visible = false; this.pasteItem2.Visible = false; this.deleteItem2.Visible = false; } } }

Deepa TS [Syncfusion]
Replied On October 18, 2005 12:51 PM UTC

Hi timjax, With the help of the RMouseDownNode property itself ,we can find the node which is been right clicked. Please take a look at this sample, contextmenu.zip which reproduces your problem. Here the above sample shows that,the selected node is not same as the node which is been right clicked. Please let me know if you have any questions.Thanks for your interest in Syncfusion products. Regards, Deepa.T.S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon