GoTextNode questions


#1

I would like to create a gotextnode where the text
a) wraps after 15 characters
b) resizes automatically even if bigger than the background shape
How do I do this?


#2

You can do:
aTextNode.Label.Wrapping = true;
aTextNode.Label.WrappingWidth = 100;
This will get what you want, except that the wrapping will occur at a particular width, rather than at a particular number of characters. If you are using a monospace font, you can calculate the correct WrappingWidth for 15 characters.
Did you really want to wrap after 15 characters, regardless of how wide that line is, even if it doesn’t line up with the previously wrapped line?
If so, one possibility is that you can implement this wrapping yourself, by not using the GoText.Wrapping and WrappingWidth properties, but by splitting the text into separate newline-separated lines, each 15 characters. You’ll need to set GoText.Multiline to true.


#3

But the text bounds box doesn’t seem to extend past the bounds of the background si if I have a GoTextnode with a roundedrectangle background set to sizeF(80,50) the text is only a couple of lines in size

PS Apart from this the product does everyting I want so far


#4
So you want the text to possibly extend beyond the background shape? That's a new request. OK, that's possible if you override LayoutChildren. Here's a definition that I haven't tried: public override void LayoutChildren(GoObject childchanged) { if (this.Initializing) return; GoText label = this.Label; if (label == null) return; GoObject back = this.Background; if (back != null) back.Center = label.Center; // in case there is no Background, position the ports around the text Label instead if (back == null) back = label; if (back != null) { if (this.TopPort != null) this.TopPort.SetSpotLocation(MiddleTop, back, MiddleTop); if (this.RightPort != null) this.RightPort.SetSpotLocation(MiddleRight, back, MiddleRight); if (this.BottomPort != null) this.BottomPort.SetSpotLocation(MiddleBottom, back, MiddleBottom); if (this.LeftPort != null) this.LeftPort.SetSpotLocation(MiddleLeft, back, MiddleLeft); } }

#5

Thanks - that almost works

  1. It mucks up the display of the nodes inthe palette (my test app based on protoapp and flowchart)
  2. the text label wraps after 2 characters
    PS I will start a newthread for some other questions