Block typing as per rodents, mouse, rat example does not work

17 views
Skip to first unread message

Gregary Boyles

unread,
Jan 2, 2022, 10:43:27 AM1/2/22
to Ardublock
I give up!

How do you make this block typing work?

I want only case and default blocks to be able to connect inside the switch block.

What are the types in setCheck(["case", "default"])  referring to exactly?
How do my case and default blocks actually get the type 'case' and default'.

There is not enough information in the mouse, rat, rodent example:




Blockly.Blocks.controls_switch =
{
  init: function()
                  {
                        this.appendDummyInput().appendField("switch");
                        this.appendValueInput("Expression").setCheck(null);
                        this.appendStatementInput("Statements").setCheck(["case", "default"]);
                        this.setInputsInline(true);
                        this.setPreviousStatement(true, null);
                        this.setNextStatement(true, null);
                        this.setColour(Blockly.Blocks.logic.HUE);
                        this.setTooltip("");
                        this.setHelpUrl("");
                  }
};

Blockly.Blocks.controls_case =
{
  init: function()
                  {
                        this.appendDummyInput().appendField("case");
                        this.appendValueInput("Expression").setCheck(null);
                        this.appendStatementInput("Statements").setCheck(null);
                        this.setInputsInline(true);
                        this.setPreviousStatement(true, null);
                        this.setNextStatement(true, null);
                        this.setColour(Blockly.Blocks.logic.HUE);
                        this.setTooltip("");
                        this.setHelpUrl("");
                  }
};

Blockly.Blocks.controls_default =
{
  init: function()
                {
                        this.appendDummyInput().appendField("default");
                        this.appendStatementInput("Statements").setCheck(null);
                        this.setInputsInline(true);
                        this.setPreviousStatement(true, null);
                        this.setColour(Blockly.Blocks.logic.HUE);
                        this.setTooltip("");
                        this.setHelpUrl("");
                }
};

switch.jpg

Moue.jpg
Reply all
Reply to author
Forward
0 new messages