Quantcast
Channel: Northwoods Software - Latest topics
Viewing all articles
Browse latest Browse all 7417

How to bind text on ports

$
0
0

@3q wrote:


How do I bind the text of port ?I want to have the same effect as the text in the Auto Panel body.
I have bound the text of port: new go.Binding("text", "text1"). MakeTwoWay (),
but Text1 was not bound to success!
my codes:

 myDiagram.nodeTemplate =
  $(go.Node, "Table",
    { locationObjectName: "BODY",
      locationSpot: go.Spot.Center,
      selectionObjectName: "BODY"
    },
    new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),

    // the body
    $(go.Panel, "Auto",
      { row: 1, column: 1, name: "BODY",
        stretch: go.GraphObject.Fill },
      $(go.Shape, "Rectangle",
        { fill: null, stroke: "rgba(255,0,0,1)", strokeWidth: 4,
          minSize: new go.Size(100, 100) }),
      $(go.TextBlock,
        { margin: 10, textAlign: "center", 
        font: "bold 14px  Segoe UI,sans-serif",
        stroke: "black", editable: true },
        new go.Binding("text", "text").makeTwoWay())
    ),  // end Auto Panel body

    
    $(go.Panel, "Vertical",
      new go.Binding("itemArray", "leftArray"),
      { row: 1, column: 0,
        itemTemplate:
          g_(go.Panel,"Spot",
            { _side: "left", 
              fromSpot: go.Spot.Left, toSpot: go.Spot.Left,
              fromLinkable: true, toLinkable: true, cursor: "pointer",
              contextMenu: portMenu },
            new go.Binding("portId", "portId"),
            $(go.Shape, "Rectangle",
              { 
                stroke: null, strokeWidth: 0,
                desiredSize: portSizeV,
                margin: new go.Margin(8,0) },
              new go.Binding("fill", "portColor")),
            $(go.TextBlock, "111",{
              _isNodeLabel: true,
              angle:90,
              font: "bold 5pt serif",
              alignment:new go.Spot(0,0,5,5)
            },new go.Binding("text", "text1").makeTwoWay())//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!How do I bind the text  of port ?
          )  // end itemTemplate
      }
    ),  
    ......
  );  // end Node

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7417

Trending Articles