Hello!
I want to add an additional text node to my class - Fb. The class Fb derives from GoGeneralNode. The code I have used to create the additional text node is very similar to the code below -
public partial class Form1 : Form
{
private GoView view;
public Form1()
{
InitializeComponent();
InitGoObjects();
Controls.Add(view);
}
private void InitGoObjects()
{
view = new AView();
view.Dock = DockStyle.Fill;
}
}
public class GgnWithExtra : GoGeneralNode
{
private GoText veryBottomLabel;
public override void Initialize(System.Resources.ResourceManager res, string iconname, string top, string bottom, int numinports, int numoutports)
{
base.Initialize(res, iconname, top, bottom, numinports, numoutports);
veryBottomLabel = CreateBottomMostText();
Add(veryBottomLabel);
}
public string NameOfBottomMostLabel
{
get { return veryBottomLabel.Text; }
set { veryBottomLabel.Text = value; }
}
public virtual GoText CreateBottomMostText()
{
GoText t = new GoText();
t.Text = "foo";
return t;
}
public override void LayoutChildren(GoObject childchanged)
{
base.LayoutChildren(childchanged);
if (this.Icon != null && veryBottomLabel != null)
{
this.Icon.SetSpotLocation(MiddleBottom, this.Icon, MiddleBottom);
this.veryBottomLabel.SetSpotLocation(MiddleBottom, this.Icon, MiddleBottom);
}
}
}
public class AView : GoView
{
private GgnWithExtra node;
public AView()
{
node = new GgnWithExtra();
node.Initialize(null, "", "Top", "Bottom", 4, 2);
node.Position = new PointF(50, 50);
Document.Add(node);
}
protected override void OnObjectSingleClicked(GoObjectEventArgs evt)
{
Random random = new Random();
node.NameOfBottomMostLabel = random.Next().ToString();
base.OnObjectSingleClicked(evt);
}
}
As far as I can tell, the only difference between the above code and my application code is in the LayoutChildren method. The LayoutChildren method that I have in my application code is -
public override void LayoutChildren(GoObject childchanged)
{
if (bLayoutSetting)
{
base.LayoutChildren(childchanged);
GoObject botlab = BottomLabel;
GoGroup icongrp = Icon as GoGroup;
if (botlab != null && icongrp != null && textForCycleTime != null && icongrp.Count > 0)
{
GoObject toprect = icongrp[0];
botlab.Center = toprect.Center;
this.TextForCycleTime.SetSpotLocation(MiddleTop, this.Icon, MiddleBottom);
}
}
}
The problem is that, the text I assign to my additional GoText doesn’t get refreshed.
What am I missing?
Thanks in advance,
Pradip