GoLink..

Hi walter
I find problem in my edit source
I try this
private void Link_make_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
MyView.NewLinkClass = typeof(GraphLink);
}
It’s Link type for another Link
namespace Classier
{
[Serializable]
public class GraphLink : GoLabeledLink
{
public GraphLink()
{
GoText t1 = new GoText();
GoText t2 = new GoText();
GoText t3 = new GoText();
t1.Alignment = Middle;
t1.Selectable = true;
this.FromLabel = t1;

t2.Alignment = Middle;
t2.Selectable = true;
this.ToLabel = t2;
t3.Alignment = Middle;
t3.Selectable = true;
this.MidLabel = t3;
}

protected override void OnLayerChanged(GoLayer oldlayer, GoLayer newlayer, GoObject mainobj)
{
if (oldlayer == null && newlayer != null && newlayer.IsInDocument)
{ GoLink l = this.GoObject as GoLink;


GoText t1 = this.FromLabel as GoText;
GoText t2 = this.ToLabel as GoText;
GoText t3 = this.MidLabel as GoText;

if (t1 != null & t2 !=null & t3 != null)
{
t1.Text = “relation”;
t2.Text = “relation”;
t3.Text = “relation”;
this.ToArrow = false;
l.ToArrow = false;
}

}
}
}
}
this is Link type
See the If()
l.ToArrow = false;
If it’s deleted, Link’s ToArrow = true;
this.ToArrow = false;
If it’s deleted, Link is two, and can’t control.
I want ToArrow is false, FromArrow is false, LinkStyle is RoundLine
But I can’t. I can other Link.
It’s ToArrow = true, LinkStyle is RoundLine
So I don’t Understand this Problem!!!

Your class inherits from GoLabeledLink, yet you are trying to safely cast it as a GoLink, which it cannot be. So the value of the variable “l” will always be null.
You already are setting this.ToArrow = false, why not do the same for the FromArrow property?
As a separate comment, why not set those properties in the constructor where you are also doing other initialization of the GoLabeledLink? I hope you have other code that you intend to execute when the link is added to a document that you have removed for the purpose of posting this note. As it is, I see no reason for having that overridden method at all. But having that method would be useful if you are going to dynamically calculate some values for the labels.

Thanks,
I solved this problem!!