Why doesn't TextBlock stretch Horizontally?

Why doesn’t my TextBlock stretch Horizontally?
My node organization is something like this:

$(go.Node, 'Spot', {

            locationSpot: go.Spot.Center,
            locationObjectName: 'BODY'
        $(go.Shape, shapes.node, nodeShapeSettings(fillColor)),
        $(go.Panel, 'Auto', {stretch: go.GraphObject.Fill, minSize: new go.Size(30, NaN)},
            $(go.Shape, 'Rectangle', {

                fill: 'transparent',
                stretch: go.Spot.Horizontal
            $(go.TextBlock, {

                    editable: true,
                    background: 'white',
                    textAlign: 'center',
                    stretch: go.GraphObject.Horizontal
                new go.Binding('text', 'text').makeTwoWay())),

There is no go.Spot.Horizontal. Was there no error? And you probably should not be setting that property on the main element of an “Auto” Panel anyway.

No, there was no error. But the TextBlock still doesn’t fill the area horizontally

When I use your template, and after replacing the unknown code with what I think would be reasonable defaults, I immediately get the error:

Error: GraphObject.stretch value is not an instance of a constant of class GraphObject: undefined

Still, I think it doesn’t make sense to try to stretch an element of a Spot Panel – what would it stretch to?

You didn’t provide two sketches or screenshots for how you’d want your node to behave with different size text. Here’s my simplified guess:

      $(go.Node, 'Spot',
        $(go.Panel, 'Auto', { desiredSize: new go.Size(130, 50) },
          $(go.Shape, "Ellipse", { fill: "lightgray" }),
              stretch: go.GraphObject.Fill, 
              background: 'white',
              textAlign: 'center'
            new go.Binding('text'))
        $(go.Shape, { width: 10, height: 10, alignment: go.Spot.Bottom })
1 Like

It works when I put a fixed width… but is it possible to have it stretch without setting a fixed width? So it can resize in case the text size exceeds the predefined width.

Perhaps I should just put a minSize on the TextBlock, that seems the simplest thing to do at the moment.