Change Button Text

Hello,

I have a decision tree node,its template is-
myDiagram.nodeTemplateMap.add(“decisionTree”,
$(go.Node, “Auto”,
new go.Binding(“text”, “text”),
// define the node’s outer shape, which will surround the Horizontal Panel
$(go.Shape, “Rectangle”,
{ fill: “whitesmoke”,
stroke: “lightgray” }),
// define a horizontal Panel to place the node’s text alongside the buttons
$(go.Panel, “Horizontal”,
$(go.TextBlock,
{ font: “10pt sans-serif”,
margin: 5 },
new go.Binding(“text”, “text”)),
// define a vertical panel to place the node’s two buttons one above the other
$(go.Panel, “Vertical”,
$(“Button”, // button A
{ name: “ButtonA”,
click: function (e, obj) { buttonExpandCollapse(obj, “ButtonA”); },
},
new go.Binding(“portId”, “a”),
$(go.TextBlock,
{ font: “8pt Helvetica, Arial, sans-serif”,
stroke: “black”,
textAlign: “center”,
margin: 5,
maxSize: new go.Size(100, NaN),
wrap: go.TextBlock.WrapFit,
editable: true },
new go.Binding(“text”, “aText”).makeTwoWay())
), // end button A
$(“Button”, // button B
{ name: “ButtonB”,
click: function (e, obj) { buttonExpandCollapse(obj, “ButtonB”); },
},
new go.Binding(“portId”, “b”),
$(go.TextBlock,
{ font: “8pt Helvetica, Arial, sans-serif”,
stroke: “black”,
textAlign: “center”,
margin: 5,
maxSize: new go.Size(100, NaN),
wrap: go.TextBlock.WrapFit,
editable: true },
new go.Binding(“text”, “bText”).makeTwoWay())
) // end button B
) // end Vertical Panel
) // end Horizontal Panel
)); // end Node and call to add

i want to edit the text inside button on click/double click.
Tried with setting editable = true but it doesn’t seem to work. Can u please tell me how to make button text editable?

Calling:

myDiagram.commandHandler.editTextBlock(someTextBlock)

Will allow you to edit text programatically, such as on a button press.

Setting editable to true does not work because the Button’s click handler handles the click event before text editing can start on the TextBlock. It’s assumed that if an object handles a click event, you would not want to also initiate text editing on that object.