How to use the blockly.FieldVariable function in blockly

To help you get started, we’ve selected a few blockly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github miguel76 / SparqlBlocks / src / blocks / text.js View on Github external
init: function() {
    this.setHelpUrl(Blockly.Msg.TEXT_APPEND_HELPURL);
    this.setColour(HUE);
    this.appendValueInput('TEXT')
        .appendField(Blockly.Msg.TEXT_APPEND_TO)
        .appendField(new Blockly.FieldVariable(
        Blockly.Msg.TEXT_APPEND_VARIABLE), 'VAR')
        .appendField(Blockly.Msg.TEXT_APPEND_APPENDTEXT);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    // Assign 'this' to a variable for use in the tooltip closure below.
    var thisBlock = this;
    this.setTooltip(function() {
      return Blockly.Msg.TEXT_APPEND_TOOLTIP.replace('%1',
          thisBlock.getFieldValue('VAR'));
    });
  },
  /**
github miguel76 / SparqlBlocks / src / blocks / variables.js View on Github external
init: function() {
    // this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);
    this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);
    this.setColour(HUE);
    this.appendDummyInput()
        .appendField("?")
        .appendField(new Blockly.FieldVariable(), "VAR");
    this.setOutput(true, "Var");
    this.setTooltip('');
    // this.appendDummyInput()
    //     .appendField(Blockly.Msg.VARIABLES_GET_TITLE)
    //     .appendField(new Blockly.FieldVariable(
    //     Blockly.Msg.VARIABLES_GET_ITEM), 'VAR')
    //     .appendField(Blockly.Msg.VARIABLES_GET_TAIL);
    // this.setTooltip(Blockly.Msg.VARIABLES_GET_TOOLTIP);
    // this.contextMenuMsg_ = Blockly.Msg.VARIABLES_GET_CREATE_SET;
    // this.contextMenuType_ = 'variables_set';
  }
});
github miguel76 / SparqlBlocks / src / blocks / bgp.js View on Github external
init: function() {
    _initVerb(this);
    this.appendValueInput("OBJECT")
        .setCheck(typeExt("Object"))
        .appendField("━")
        .appendField(new Blockly.FieldVariable(), "VAR")
        .appendField("━▶");
    this.setInputsInline(true);
    this.setPreviousStatement(true, "PropertyList");
    this.setNextStatement(true, "PropertyList");
    this.setTooltip(Msg.VERB_OBJECT_TOOLTIP);
  }
});