Unable to find [flyouttoolbox][toolboxitem] in the registry.

172 views
Skip to first unread message

ahmad sulaibi

unread,
Aug 24, 2022, 7:07:25 AM8/24/22
to Blockly
Hello,

    Every time I run my HTML page an error appears in the console. I injected my toolbox into blocklyDiv as is explained in blockly documentation: https://developers.google.com/blockly/guides/configure/web/fixed-size.

Below is my injection code followed by the console error.

// Injection code
let workspace = Blockly.inject('blocklyDiv',
{
    toolbox: toolbox,
    grid: {
      spacing: 0,
      length: 0,
      colour: '#ddd',
      snap: true
        },
    zoom:{
        controls: true,
        wheel: true,//false
        startScale: 1.0,
        maxScale: 1.5,
        minScale: 0.8,
        scaleSpeed: 1.02
    },
trashcan: true,
});
Blockly.getMainWorkspace().getToolbox();

// My toolbox
export let toolbox = {
    "kind": "categoryToolbox",
    "contents": [
        {
            "kind": "category",
            "name": "Control",
            "categorystyle": "logic_category",
            "contents": [
                {
                    "kind": "block",
                    "type": "controls_if",
                    "name":"if"
                },
                {
                    "kind": "block",
                    "type": "lists_isEmpty"
                },
                {
                    "kind": "block",
                    "type":"logic_operation"
                },
                {
                    "kind" : "block",
                    "type" : "math_number",
                },
                {
                    'kind': 'block',
                    'type': 'play_sound'
                },
                {
                    "kind": "block",
                    "type": "controls_for",
                    "inputs": {
                      "FROM": {
                        "block": {
                          "type": "math_number",
                          "fields": {
                            "NUM": 1
                          }
                        }
                      },
                      "TO": {
                        "block": {
                          "type": "math_number",
                          "fields": {
                            "NUM": 10
                          }
                        }
                      },
                      "BY": {
                        "block": {
                          "type": "math_number",
                          "fields": {
                            "NUM": 1
                          }
                        }
                      },
                    }
                  },
            ],
            "toolboxitemid": "logic",
            "family": "Georgia, serif",
            "weight": "bold"
        },
        {
        "kind": "category",
        "name": "Logic",
        "contents": [
            {
            "kind": "block",
            "type": "logic_compare",
            "name": "Equal"
            },

            {
            "kind": "block",
            "type": "logic_operation",
            "name" : "BOOL!"
            },

            {
            "kind": "block",
            "type": "logic_boolean"
            },

            {
                "kind":"block",
                "type":"math_number",
                "name":"texts"
            }
        ]},
        {
            "kind": "category",
            "name" : "values",
            "custom" : "PROCEDURE",
            "contents" : [
            {
                "kind" : "button",
                "text" : "math_number"
                // "callbackkey": "myFirstButtonPressed"
            }
        ]},
        {
            "kind": "flyoutToolbox",
            "name": "nice",
            "contents": [
                {
                  "kind": "block",
                  "type":"logic_operation"
                },
                {
                  "kind": "label",
                  "text": "A label",
                  "web-class": "myLabelStyle"
                },
                {
                  "kind": "label",
                  "text": "Another label"
                },
                {
                  "kind": "block",
                  "type": "logic_negate"
                },
                {
                  "kind": "button",
                  "text": "A button",
                  "callbackKey": "myFirstButtonPressed"
                },
                {
                  "kind": "block",
                  "type": "logic_boolean"
                }
              ]
        },
    ]
};

// Console Errortoolbox_flyoutbox.png

Neil Fraser

unread,
Aug 25, 2022, 5:31:04 AM8/25/22
to blo...@googlegroups.com
Which version of Blockly are you using?  I am using a 9 month old version of Blockly and encountered a nearly identical error as a result of two missing requires for Blockly.Css.  The fix is here:
However this issue has already been corrected on the master branch, so if you are using the current release then that's not the problem.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/dc151b19-0d03-4a6b-92ee-543aa052117cn%40googlegroups.com.


--

ahmad sulaibi

unread,
Aug 30, 2022, 6:08:19 PM8/30/22
to Blockly
Sorry for the late response, I am using the latest blockly. I restarted my blockly and it dissapear.
Reply all
Reply to author
Forward
0 new messages