Editing error in tree

I use pop up menu with tree. Setting labeledit to true makes all the nodes to be in the editable mode if F2 is pressed. I want to edit the particular node only with pop up menu. Thanks in advance. Mari

1 Reply

DT Deepa TS Syncfusion Team June 5, 2006 10:37 AM UTC

Hi Mari, Thanks for using Syncfusion products. You can edit the particular node only with popup menu by using the popupMenusManager and by disabling the editing behavior once the editing operation is completed using TreeViewAdv NodeEditorValidated event. TreeNodeAdv editedNode = null; //Handling the TreeViewAdv''s MouseDown event in the following way,will help you in getting the selected node''s PopupMenu when right clicked. private void treeViewAdv1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Right) { // get the point where the mouse was right clicked Point p = this.treeViewAdv1.PointToClient(Control.MousePosition); // get the node at the right click point editedNode = this.treeViewAdv1.PointToNode(p); this.treeViewAdv1.SelectedNode=editedNode; } } //The TreeViewAdv''s BeginEdit method makes the selected node editable. private void barItem1_Click(object sender, EventArgs e) { if (this.editedNode != null) { this.treeViewAdv1.SelectedNode = this.editedNode; this.treeViewAdv1.LabelEdit = true; this.treeViewAdv1.BeginEdit(); } } //Disable the editable behavior ,once the editing operation is over. private void treeViewAdv1_NodeEditorValidated(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvEditEventArgs e) { this.treeViewAdv1.LabelEdit=false; } Please take a look at the attached sample and let me know if this helps you. Regards, Deepa

EditNode.zip

Loader.
Up arrow icon