Disconnected links


#1

Hi
We are on Win 2.2.0 running under .net 1.1.
I have a diagram with linked nodes and when I move a node from one location to another using the mouse, the link can become seperated from the node. This does not happen all of the time and the distance from the end of the link to the node varies. If I move the effected node again, the link will reattach to the node.
The disgram is simple ie 5 nodes and 5 links.
Can you please advise what is happening?


#2

Could you describe what kinds of nodes/ports/links you have and whether/how they override any methods?
I assume you don’t see this behavior when you run the standard samples.


#3

Hi Walter
My application is roughly based on the Protoapp sample. The nodes are now GoIconicNode ie only 1 port - Text and OnContextClick method are overridden. The links are GoLabeledLink - the OnContextClick method is overriden.
Protoapp as it comes standard seems to work OK.
The link disconnections occur when I am manually moving nodes in the diagram, which doesn’t activate any of my code (that I can see). So I am assuming it is something to do with GoDiagram.
Please let me know if you need any more info.


#4

Well, nothing comes to mind, given what you say.
Can you exhibit the problem with just two nodes and one link?
Did you change any port properties, such as GoPort.PortObject?
Does changing GoView.DragsRealtime make any difference?
Might there be some exceptions occurring? Is there any Trace output?


#5

This is almost realtime debugging!
Changing GoView.DragsRealtime to true makes a difference! Links are now not being disconnected when being moved (in the tests I’ve just done). To check, I unset DragsRealtime and the problem reappears.
Also I have goView1.Document.UndoManager = new GoUndoManager(); – I don’t know if this is related.
Is having DragsRealtime set to true going to have any -ve impacts on my application?
Thanks


#6

The only negative effect of setting GoView.DragsRealtime to true is performance-related. There’s a lot more computation in constantly updating the display, and there’s more changes that get recorded in the undo manager.
The behavior you see is probably due to GoLink.OnPortChanged either not being called or being called and not calling CalculateStroke, when a port has been moved.
I suppose you could override GoLink.CalculateStroke to just call the base method, so you can set a breakpoint to see if it is being called after the user moves a node, assuming DragsRealtime == false.
The more likely reason for OnPortChanged not being called is that the port perhaps isn’t being moved properly. That’s usually because an override of LayoutChildren isn’t doing the right calculations. (See the FAQ.) But you didn’t say you overrode that method (GoGroup.LayoutChildren), so I can’t theorize any explanation.