Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 6968

Placing node parts

$
0
0

@emadden wrote:

How do I place node parts more precisely? I want a node that displays the name (category), a port, and a Panel/PanelExpanderButton, but the Panel types I'm using aren't working how I expected them to. Can someone help?

templateMap.add("Entry",
        $(go.Node, "Auto",
            new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
            $(go.Shape, "RoundedRectangle",
                {
                    fill: "lime",
                    width: 75,
                    height: 75
                }),
           $(go.Panel, "Vertical",
               $(go.TextBlock,
                   new go.Binding("text", "category"),
                   {
                       editable: false
                   })),
                $(go.Panel, "Horizontal",
                    $("PanelExpanderButton", "details"),
                    $(go.Panel, "Vertical",
                        {
                            name: "details",
                            itemTemplate:
                                $(go.Panel, "Horizontal",
                                    $(go.Shape, "Rectangle", {fill: "white", width: 40, height: 40}),
                                    $(go.TextBlock, new go.Binding("text", "prop")),
                                    $(go.TextBlock, new go.Binding("text", "val"))
                                )
                        })
                ),
            makePort("R", go.Spot.Right)
        ));

Where makePort() just returns a small square with port properties set.
This is how my node looks

The textBlock and port shape are organized how I want, but why isn't the panel and panel expander button positioned vertically under it? Should I maybe just use a table?

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6968

Trending Articles