GoMultiTextNode text colours in SubGraph


#1

I have a GoMultiTextNode descendant that I’d like to format like the Record Node in your Demo1 sample. ie, with a dark blue header text and gray sub-headings.
This works fine until I place the node into a GoSubGraph which causes the header text to be drawn with a gray background with white text.
Only when the object is selected does the header text have a dark blue background.
This the code for CreateText() in my GoMultiTextNode descendant:

<FONT face="Courier New, Courier, mono"><FONT color=#0000ff size=1>public</FONT><FONT size=1> </FONT><FONT color=#0000ff size=1>override</FONT><FONT size=1> GoText CreateText(String s, </FONT><FONT color=#0000ff size=1>int</FONT></FONT><FONT size=1><FONT face="Courier New, Courier, mono"> idx) </FONT>
<FONT face="Courier New, Courier, mono">{</FONT>
<FONT face="Courier New, Courier, mono">    GoText t = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>base</FONT><FONT size=1><FONT face="Courier New, Courier, mono">.CreateText(s, idx);</FONT>
<FONT face="Courier New, Courier, mono">    t.StringTrimming = StringTrimming.EllipsisCharacter;</FONT>
<FONT face="Courier New, Courier, mono">    t.Height = t.Font.GetHeight() + DEFAULT_TEXT_LEADING;</FONT>
<FONT face="Courier New, Courier, mono">    t.Selectable = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>true</FONT><FONT size=1><FONT face="Courier New, Courier, mono">;</FONT>
<FONT face="Courier New, Courier, mono">    t.Deletable = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>false</FONT><FONT size=1><FONT face="Courier New, Courier, mono">;</FONT>
<FONT face="Courier New, Courier, mono">    t.Editable = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>true</FONT><FONT size=1><FONT face="Courier New, Courier, mono">;</FONT>
<FONT face="Courier New, Courier, mono">    t.AutoResizes = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>false</FONT><FONT size=1><FONT face="Courier New, Courier, mono">;</FONT>
<FONT face="Courier New, Courier, mono">    t.Clipping = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>false</FONT><FONT size=1><FONT face="Courier New, Courier, mono">;</FONT>
<FONT face="Courier New, Courier, mono">    t.Wrapping = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>false</FONT><FONT size=1><FONT face="Courier New, Courier, mono">;</FONT>
<FONT face="Courier New, Courier, mono">    t.Multiline = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>false</FONT><FONT size=1><FONT face="Courier New, Courier, mono">;</FONT>
<FONT face="Courier New, Courier, mono">    t.BackgroundOpaqueWhenSelected = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>true</FONT><FONT size=1><FONT face="Courier New, Courier, mono">;</FONT>
</FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>    if</FONT><FONT size=1><FONT face="Courier New, Courier, mono"> (idx == 0) </FONT>
<FONT face="Courier New, Courier, mono">    {</FONT>
</FONT><FONT color=#008000 size=1><FONT face="Courier New, Courier, mono">        // setting for header text</FONT></FONT><FONT size=1>
<FONT face="Courier New, Courier, mono">        t.BackgroundColor = Color.MediumBlue;</FONT>
<FONT face="Courier New, Courier, mono">        t.TextColor = Color.White;</FONT>
<FONT face="Courier New, Courier, mono">        t.Alignment = GoObject.MiddleCenter;</FONT>
<FONT face="Courier New, Courier, mono">        t.Bold = </FONT></FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>true</FONT><FONT size=1><FONT face="Courier New, Courier, mono">;</FONT>
<FONT face="Courier New, Courier, mono">    }</FONT>
</FONT><FONT color=#0000ff size=1><FONT face="Courier New, Courier, mono">    else</FONT></FONT><FONT size=1>
<FONT face="Courier New, Courier, mono">    {</FONT>
</FONT><FONT color=#008000 size=1><FONT face="Courier New, Courier, mono">        // settings for sub-heading text</FONT></FONT><FONT size=1>
<FONT face="Courier New, Courier, mono">        t.BackgroundColor = Color.Gray;</FONT>
<FONT face="Courier New, Courier, mono">        t.TextColor = Color.Black;</FONT>
<FONT face="Courier New, Courier, mono">        t.Alignment = GoObject.MiddleLeft;</FONT>
<P align=left><FONT face="Courier New, Courier, mono">    }</FONT>
</FONT><FONT face="Courier New, Courier, mono" color=#0000ff size=1>    return</FONT><FONT size=1><FONT face="Courier New, Courier, mono"> t;</FONT>
<FONT face="Courier New, Courier, mono">}</FONT>

Any ideas what I’m doing wrong?
By the way, is there a better way to format code (ie, without the extra line spacing) using this forum post editor?


#2

I don’t see why the appearance of a node might change just because it is part of a GoSubGraph. If you programmatically change the Parent of one of your nodes from being a top-level object to be a child of a subgraph, does the appearance change?