Diagram.MouseDoubleClick and ClickSelectingTool.DiagramClicked

Hi Walter,

I am using Diagram.MouseDoubleClicked event and ClickSelectingTool.DiagramClicked event for tracking double click and click so as to get the node underneath the clicks.

There are two different logics I have to perform on both the clicks.

Unfortunately when I do double click or click the control goes to ClickSelectingTool.DiagramClicked.

How can I distinguish these events ?

I’m confused by your asking about the ClickSelectingTool.DiagramClicked event. There is no such event: http://goxam.com/3.0/apicore/#Northwoods.GoWPF~Northwoods.GoXam.Tool.ClickSelectingTool_members.html

Apologies. Thats a custom event I had added on DoMouseUp event.

Let me rephrase,
I am using Diagram.MouseDoubleClicked event and ClickSelectingTool.DoMouseUp event for tracking double click and click so as to get the node underneath the clicks but I see DoMouseUp is called even during the DoubleClick(DoMouseUp event is called twice)

That is correct – a double click consists of mouse down-up-down-up events within a certain space and time.

I do not understand what you are trying to achieve.

I have some code to run when its double clicked on a node or link and some other code to run when its just clicked on any node or link.

I basically want to distinguish double click and single click

A single click should always happen before a double click. Unless you want to wait after the first mouse up for a second mouse down and up to maybe happen, before you can decide that a double click cannot happen and therefore there will only be a single click.

Do you mean that I cannot distinguish single and double click on diagram?

Of course you can: https://docs.microsoft.com/en-us/dotnet/api/system.windows.input.mousebuttoneventargs.clickcount?view=net-5.0

I was pointing out that when a click happens, it is impossible to know if another click will happen again soon enough and close enough to count as a double click. (Same is true for distinguishing double clicks from triple clicks.) The only way to find out is to wait to see if a double click did not happen. The easiest way to do that is to have the click handler set a timer that waits until a double click is supposed to have happened, and in the double click handler set a flag that a double click did happen. If in the timer event the flag hadn’t been set, then only a single click happened.