Walter, I cannot get the text of my GoBasicnode to be left justified. The text appears center justified. Can you help?
Here’s a code snippet:
class EquationNode : GoBasicNode
{
public EquationNode()
{
this.Label = new GoText();
this.Label.Text = string.Format(“Blah\nBlah”);
this.Label.Alignment = GoText.MiddleLeft;
this.Label.Multiline = true;
Well, you can’t tell when both lines of the text are the same length, but this worked fine for me:
[Serializable]
public class EquationNode : GoBasicNode {
public EquationNode() {
this.Text = “short\na long long line”;
this.Label.Multiline = true;
this.Label.Alignment = MiddleLeft;
}
}
However, perhaps you are seeing the effects of GoBasicNode.LayoutChildren making sure the GoText.Alignment is appropriate for the side of the node that the label is at, according to the GoBasicNode.LabelSpot. This will reset the Alignment when you change the text string, for example. You can get around this by just reassigning it the way you want afterwards.
[Serializable]
public class EquationNode : GoBasicNode {
public EquationNode() {
this.Text = “short\na long long line”;
this.Label.Multiline = true;
}
public override void LayoutChildren(GoObject childchanged) {
base.LayoutChildren(childchanged);
if (this.Label != null) this.Label.Alignment = MiddleLeft;
}
}
Thanks Walter! The override of LayoutChildren did the trick.