How to use the blockly.FieldNumber 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 / exec.js View on Github external
if (parameter.type) {
               input.setCheck(typeExt(parameter.type));
            }
            if (parameter.label) {
               input.appendField(parameter.label);
            }
          }
        }
      }
      this.setInputsInline(false);
      if (options.builtinQuery) {
        this.setColour(290);
        if (!options.selfLimiting) {
          this.appendDummyInput()
              .appendField("limit to first")
              .appendField(new Blockly.FieldNumber(defaultLimit, 0, maxLimit), "LIMIT")
              .appendField("rows");
        }
      } else {
        if (options.baseQuery) {
          this.setColour(290);
          // this.appendDummyInput();
          this.appendStatementInput("WHERE")
              .setCheck(typeExt("GraphPattern"))
              .appendField("where");
          Blocks.query.orderFields.init.call(this);
          this.setInputsInline(true);
        } else {
          this.setColour(330);
          this.appendStatementInput("QUERY")
              .setCheck(typeExt("SelectQuery"))
              .appendField(" ⚙");
github miguel76 / SparqlBlocks / src / blocks / order_fields.js View on Github external
if (!limitField && queryBlock.getInput("LIMIT")) {
      queryBlock.moveInputBefore(inputName, "LIMIT");
    }
    // queryBlock.moveInputBefore(inputName, "RESULTS");
  }
  if (dirFieldName) {
    var dirField = new Blockly.FieldDropdown([["▲", "ASC"], ["▼", "DESC"]]);
    if (oldDirValue) {
      dirField.setValue(oldDirValue);
    }
    input.appendField(dirField, dirFieldName);
  }
  if (limitField) {
    input.appendField("  limit to first", otherFieldNames[0])
        .appendField(
          new Blockly.FieldNumber(oldLimitValue || defaultLimit, 0, maxLimit),
          otherFieldNames[1])
        .appendField("rows", otherFieldNames[2]);
  } else {
    input.appendField(
        index > 1 ?
            (!lastOrderField || index > 2 ? ", " : "") +
                (lastOrderField ? "and " : "") + "then by" :
            "order by",
        otherFieldNames[0]);
  }
  if (lastOrderField) {
    setOrderField(queryBlock, index + 1, false, true);
  }
};
github miguel76 / SparqlBlocks / src / blocks / math.js View on Github external
init: function() {
    this.setHelpUrl(Blockly.Msg.MATH_NUMBER_HELPURL);
    this.setColour(HUE);
    this.appendDummyInput()
        .appendField(new Blockly.FieldNumber(0), 'NUM');
    this.setOutput(true, 'LiteralNumber');
    this.setTooltip(Msg.MATH_NUMBER_TOOLTIP);
  }
});