Cursor image when drawing links

When drawing a link manually from one port to the next the cursor changes to a display a hand. This is ok if the port is valid to be a source port. However, I have cases where two ports may never be connected manually.

Is is possible to change the appearance of the cursor back to the pointer image programatically when I try to draw a link from an invalid source port?

I have another rather closely related question which is why I didn’t open another topic. I have a GoPalette holding certain nodes which may be added to a GoView via drag&drop. When doing an external drag into the view an image of the node follows the cursor. I have overriden the GetExternalDragImage to always return null so no image gets displayed. Yet, dragging an image around in the palette itself still means dragging around a copy of the image.

How can I in gernal disallow having a copy moving around with my mouse cursor?

Are you saying that the user can never draw a link from a particular source port? If so, just set GoPort.IsValidFrom = false.

But if the user might be able to draw a link from a particular port, it makes sense to have the cursor provide feedback that a link is possible from there. I assume that isn’t the problem you are talking about. So I can speculate that you are interested in having the cursor change when the mouse is over a port that the user cannot link to, but that the rest of the time the cursor is still a “hand” during the linking operation.

If that’s the situation you are interested in, you can certainly set GoView.CursorName in an override of GoToolLinkingNew.DoMouseMove.

Regarding your other question, which in my eyes doesn’t seem to be related at all:

I haven’t tried this, but I think you need to customize the Palette’s GoToolDragging tool by overriding its CreateDragSelection method to return an empty GoSelection:

public override GoSelection CreateDragSelection() { return new GoSelection(null); }
I hope this helps.

Sorry, maybe I didn’t explain clear enough. I have nodes with multiple ports. While some of the ports can only act as destination ports other can act as both. For this example lets say the LeftPort can only act as destination port, not as source port. Now, when a user tries to create a link from the LeftPort to any other port, the mouse cursor changes to the hand. My goal is it to not change the mouse cursor if a user tries to draw a link from exactly that LeftPort. Still, I want the LeftPort to be valid to act as destination port. Is is possible?

Doesn’t overriding the CreateDragSelection and returning null mean to have no GoSelection at all dropped in the view?

I do want a GoSelection to be draged from a GoPalette into a GoView, but I don’t want the image of the selection to be displayed directly under my cursor while dragging the selection. I need to insert the selection on links, ports or nodes so I must see what my cursor is moving over, which is hard if my selection covers what I need to see :)
Moving around a GoSelection inside a GoView does exactly what I want for moving around a GoSelection inside a GoPalette, as well as moving a GoSelection onto the GoView.

As always i appreciate your help.

On a LeftPort (for example) setting GoPort.IsValidFrom = false as Walter suggests prevents creating a link “from” that node, but the LeftPort is still a “to” port, and GoDiagram does let you create links starting at the “to” port and then linking to the “from” port.

If you want “forward only” linking, you can set GoToolLinking.ForwardsOnly to be true.

(myView.FindMouseTool(typeof(GoToolLinkingNew)) as GoToolLinkingNew).ForwardsOnly = true;

and that should get rid of the hand over a “to” port.


DragSelection is separate from Selection… have you tried what Walter suggested?

Cursor issue:

Setting ForwardsOnly to true still doesn’t remove the hand and now lets me move around the whole node as if selected regularly.

Drag issue:

Yes I tried Walters suggestion but no selection was dragged onto the view as expected.

ok… you have to have your own GoPort class that overrides:

public override String GetCursorName(GoView view) {

bool forwardsOnly = (view.FindMouseTool(typeof(GoToolLinkingNew)) as GoToolLinkingNew).ForwardsOnly;

if (forwardsOnly && !CanLinkFrom()) {

return null;


return base.GetCursorName(view);


Well, your line

bool forwardsOnly = (view.FindMouseTool(typeof(GoToolLinkingNew)) as GoToolLinkingNew).ForwardsOnly;

raises a NullReferenceException. I can only guess, but my view is an instance of a class extending GoView. However, I removed that line and simply use

public override String GetCursorName(GoView view)
if (!CanLinkFrom())
return null;
return base.GetCursorName(view);

which works without exception and does exactly what I desired. Thanks to you both.

Have you been able to see to the DragSelection issue yet?

Have you been able to see to the DragSelection issue yet?

I’m not sure I understand your requirements. You overrode GetExternalDragImage and that worked for palette to view, right? What else do you want?

Sorry, I was on vacation and should have left a note.

I neither want a DragImage to appear in my GoPalette nor in my GoView. I also dont want a DragImage to appear when I drag a GoSelection from a GoPalette into a GoView.

By overriding GetExternalDragImage the DragImage is only supressed if I drag my selection into the view, but not while I drag around my selection inside the GoPalette.


1) to not show the object dragging in the palette, simply set DragsRealtime = true; (yes, not intuitive, but it works for me)

2) to not show the object dragging in the GoView… Walter’s suggestion works. Set DragsRealtime = false and use this dragging tool:


public class NoDragObjDraggingTool : GoToolDragging {

public NoDragObjDraggingTool(GoView v) : base(v) { }

public override GoSelection CreateDragSelection() {

return new GoSelection(null);



#2 probably works in the palette too, I haven’t tried that.


Jake, I once again appreciate your support! Your help solved my problem. However, it seems that you dont even need the DraggingTool. All the code I needed to add was:

class MView: GoView

protected override GoObject GetExternalDragImage(DragEventArgs evt)
return null;

class MPalette: GoPalette
public MPalette(MView view)
this.DragsRealtime = true;

Please Help, the relink no longer works after I upgraded from v2 to v4. The hand cursor is no longer showed; therefore, I can’t relink the channel. I would work fine if I reverted back to older version. Do you have any idea why? Thanks in advance for your help!