MouseHover and GoToolDragging


I have a question concerning the MouseHover event. I want to recognize when the Mouse hovers over a GoBoxNode and the GoToolDragging is active. How can I do that? Will I need to create my own Tool and overwrite the DoMouseHover Method?



I think you coud override GoNodeBox.OnHover and check if view.Tool is GoDraggingTool.

The problem is that the OnHover doesn’t occur if the GoDraggingTool is active. So overriding doesn’t help.

Then maybe you could override GoNodeBox.OnSelectionDropReject or GoNodeBox.OnEnterLeave . Those are invoked by the dragging tool.

The GoView.ObjectHover and GoView.BackgroundHover events aren’t supposed to be raised during a drag, which is why GoView.DoMouseHover, GoToolDragging.DoMouseHover, GoView.DoHover, and GoObject.OnHover (in that order) aren’t called.
So defining a custom dragging tool would make sense.
Please note that some of the standard Control events don’t make sense for a GoView. That’s true for the Control.MouseHover event, since it would normally only be raised once while the mouse is within the GoView even if the user moves the mouse and waits over different GoObjects. So the Control.MouseHover event is nearly useless for GoDiagram applications.
First, we need to be able to detect when a hover has occurred, and we can only do that upon starting a timer in a mouse over event. So we override GoToolDragging.DoMouseOver to also call GoView.DetectHover.
Second, when a hover event occurs the tool needs to call the appropriate GoObject.OnHover methods. So we override GoToolDragging.DoMouseHover to call GoView.DoHover.
public class CustomDraggingTool : GoToolDragging {
public CustomDraggingTool(GoView view) : base(view) {}
public override void DoMouseOver(GoInputEventArgs evt) {
public override void DoMouseHover() {
This definition is pretty simple because the basic functionality is already provided by those two public GoView methods: DetectHover and DoHover. That’s why there are so many methods, on the GoView, on the GoTools, and on the GoObjects – we have tried to separate standard implementations of functionality from the methods that have the responsibility to provide functionality.

Thanks Walter, this solved my problem.