Hello, sorry if my english it’s a little bad.
I’ve got a problem concerning a link.
I try to read other topics about this subject but i don’t understand everything.
I’ve got a node :
GoBasicNode node1 = new GoBasicNode(GoFigure.Rectangle);
node1.Text = “Tâche”;
node1.LabelSpot = GoObject.Middle;
node1.Location = new PointF(200, 80);
node1.Editable = true;
node1.Shape.FillShapeHighlight(Color.FromArgb(80, 180, 240), Color.FromArgb(255, 255, 255));
node1.Label.Editable = true;
node1.Label.Multiline = true;
node1.Port.IsValidDuplicateLinks = false;
node1.Port.IsValidSelfNode = true;
goView.Document.Add(node1);
I want for this node just one link, the user will not be able to make more than one link.
I read that there is this fonction : IsValidLink, but i don’t know how to use it.
Please help me.
It’s ok, i find the solution with isValidSingleLink
Actually it’s not exactly what I expected. :(
Because I wanted that my node can’t have two link witch can go to another node . With IsValidSingleLink it works but if there is a link come from a decision for example, I can’t make another link on my node to go to another.
I don’t know if I explain myself well.
Jake
April 28, 2011, 10:34am
4
IsValidSingleLink is one link in or one link out, but not both. It sounds like you want to allow one link in, and one link out, is that right? Try this:
[Serializable]
public class OneInOneOutBasicNode : GoBasicNode {
public OneInOneOutBasicNode() {
this.LabelSpot = GoObject.Middle;
this.Editable = true;
this.Shape.FillShapeHighlight(Color.FromArgb(80, 180, 240), Color.FromArgb(255, 255, 255));
this.Text = “OneInOneOutBasicNode”;
this.Label.Editable = true;
this.Label.Multiline = true;
}
protected override GoShape CreateShape(GoPort p) {
return new GoDrawing(GoFigure.Rectangle);
}
protected override GoPort CreatePort() {
OneInOneOutBasicPort p = new OneInOneOutBasicPort();
p.FromSpot = GoObject.NoSpot;
p.ToSpot = GoObject.NoSpot;
return p;
}
}
[Serializable]
public class OneInOneOutBasicPort : GoPort {
public override bool CanLinkFrom() {
if (this.DestinationLinksCount > 0) return false;
return base.CanLinkFrom();
}
public override bool CanLinkTo() {
if (this.SourceLinksCount > 0) return false;
return base.CanLinkTo();
}
}
--------------------
and create it like this:
OneInOneOutBasicNode n1 = new OneInOneOutBasicNode();
n1.Text = “label”;
n1.Location = new PointF(300, 300);
doc.Add(n1);
It’s completely that.
I’ll try this, thank you.
And if it doesn’t work, I’ll tell you