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. Image for the cookie policy date

On node click "NodeClick" event get executed twice.

Dear I was trying to capture single node click event, but when I click any node of a diagram, "diagram1_NodeClick" method executes twice. Please let me know solution for the same. Note: Syncfusion Essential suite ver is: 3.2.1.0 Sample Code: this.diagram1.NodeClick += new NodeMouseEventHandler(diagram1_NodeClick); private void diagram1_NodeClick(object sender, NodeMouseEventArgs evtArgs) { MessageBox.Show("Node Name:" + ((MapNode)evtArgs.Node).Name + " longinfo:" + ((MapNode)evtArgs.Node).NodeInfo); }

5 Replies

SU sudarshan.vatturkar June 15, 2005 12:44 PM UTC

Dear On button click if I select activate tool as a “customsymbol” and if user place the node anywhere in a diagram, it raises the "NodeClick" event. How I can restrict raising of NodeClick event? Thanks Sudarshan


AD Administrator Syncfusion Team June 16, 2005 10:25 PM UTC

Hi Sudarshan, The Diagram.NodeClick event will be generated once for each node in the diagram that lies under the point that was clicked on. Hence when clicking complex nodes such as Symbols you will encounter multiple occurences of the NodeClick click. For instance when clicking a Symbol made up of a Rectangle shape node, the NodeClick event will be fired once with the Symbol as the NodeMouseEventArgs.Node param, and a second time with the symbol''s child Rectangle node as the Node param. Examining the type of the event argument''s Node type will let you filter the event depending on the node that you are interested in. Regards Prakash Surendra Syncfusion Inc.,


AD Administrator Syncfusion Team June 16, 2005 11:01 PM UTC

Sudarshan, Thank you for pointing out the issue with the NodeClick event being generated when using the InsertSymbolTool. Looking into this problem made us realize that the InsertSymbolTool/InsertNodeTool should ideally create and insert the diagram node in response to the MouseUp event and not the MouseDown event. We have made the necessary changes and starting with the next update of Essential Diagram, the NodeClick event will not be generated when inserting a new node. For the time being you can workaround the problem by handling the event only if the Diagram SelectTool is active when the event is being fired. The SelectTool will be active when the node is directly clicked on. The following code shows the implementation, private void diagram_NodeClick(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) { Syncfusion.Windows.Forms.Diagram.Tool selecttool = this.diagram.Controller.GetTool("SelectTool"); if(selecttool.Active == true) { System.Diagnostics.Trace.WriteLine("Node Click"); } } Prakash Surendra Syncfusion Inc.,


SU sudarshan.vatturkar June 17, 2005 10:19 AM UTC

Dear Prakash Thanks for your reply, my symbol node is not a complex node it only uses rectangle. Still I got two events on node click. I use default lable proeprty for showing in-line text inside node. Thnaks Sudarshan >Hi Sudarshan, > >The Diagram.NodeClick event will be generated once for each node in the diagram that lies under the point that was clicked on. Hence when clicking complex nodes such as Symbols you will encounter multiple occurences of the NodeClick click. For instance when clicking a Symbol made up of a Rectangle shape node, the NodeClick event will be fired once with the Symbol as the NodeMouseEventArgs.Node param, and a second time with the symbol''s child Rectangle node as the Node param. Examining the type of the event argument''s Node type will let you filter the event depending on the node that you are interested in. > >Regards >Prakash Surendra >Syncfusion Inc.,


AD Administrator Syncfusion Team June 20, 2005 06:01 PM UTC

Sudarshan, An Essential Diagram Symbol is a complex type ie., it can and will contain child nodes that provide its geometry. A Symbol composed of a Rectangle will still result in multiple occurences of the NodeClick event as the event will be generated for the Symbol node once, and for the child Rectangle shape the second time around. This is the correct behavior. If your intention is to just listen for events on the contained shape, an option would be to filter out the event handling code if the NodeEventArgs.Node member is of a Symbol type. Regards, Prakash Surendra Syncfusion Inc.,

Loader.
Live Chat Icon For mobile
Up arrow icon