cannot use custom blocks without category

30 views
Skip to first unread message

Sketch

unread,
Nov 28, 2021, 4:46:40 AM11/28/21
to Blockly
Hi everyone,
I am wanting to have a toolbox with no category and custom blocks however when is use a custom block outside of a category i get the block events is not defined error even when it is.
For example when i use this toolbox XML:
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none">
  <block type="events">
    <field name="NAME">pfl</field>
  </block>
  <block type="colour_random"></block>
</xml>
I get this error:
Screenshot 2021-11-28 10.44.53 AM.png
But when i use a toolbox with the standard blocks e.g. the random color block and the XML: <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none">
  <block type="colour_random"></block>
</xml>
it just works as expected.
is there any reason for this or a way to fix this?
Thanks

Beka Westberg

unread,
Nov 28, 2021, 2:46:20 PM11/28/21
to blo...@googlegroups.com
Hmmm well it seems like Blockly is having trouble finding your block definition. Where are you defining the 'events' block? If it's in a different file, how are you importing it?

Once we have a bit more information I'm sure someone here can help you out =)
--Beka

--
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/dc1f0e46-777a-4edd-b287-17ac4397c0edn%40googlegroups.com.

Sketch

unread,
Nov 28, 2021, 3:07:55 PM11/28/21
to Blockly
Thanks for writing back Beka!
Note: I removed the toolbox XML else i couldn't work on other stuff.
Second note: the block is defined in the blocks function.
Op zondag 28 november 2021 om 20:46:20 UTC+1 schreef bekawe...@gmail.com:

Sketch

unread,
Nov 29, 2021, 1:25:25 PM11/29/21
to Blockly
Hi.
The issue has been resolved had to place the blocks before injection.
Thanks 

Op zondag 28 november 2021 om 21:07:55 UTC+1 schreef Sketch:
Reply all
Reply to author
Forward
0 new messages