You current JSON definition is:
{
"type": "block_type",
"message0": "Change this text %1",
"args0": [
{
"type": "input_value",
"name": "NAME"
}
],
"output": null
}
The above code implicitly creates a label field with the text "Change
this text". However, this label field is unnamed, and thus cannot be
referenced if you wish to change it. In order to name a label field,
you can create it explicitly:
{
"type": "block_type",
"message0": "%1 %2",
"args0": [
{
"type": "field_label",
"text": "Change this text",
"name": "LABEL"
},
{
"type": "input_value",
"name": "NAME"
}
],
"output": null
}
Now you can set the text with:
block.setFieldValue('Hello', 'LABEL');
Hmm, named labels ought to be added to the documentation:
https://developers.google.com/blockly/guides/create-custom-blocks/define-blocks#label
> --
> You received this message because you are subscribed to the Google Groups "Blockly" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
blockly+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
--
Neil Fraser
https://neil.fraser.name