How to add Icon for category?

1,250 views
Skip to first unread message

Nicholas Li

unread,
Jan 8, 2018, 2:18:13 AM1/8/18
to Blockly
Hi,

I want to add some Icon for my category in toolbox (like below example), I guess that needs add some code after blocklyTreeIcon in css.js. 
But I do not know how to code it, Is there any development guide for how to do that?

Thanks,

~Nick

Erik Pasternak

unread,
Jan 8, 2018, 1:39:29 PM1/8/18
to Blockly
Hi Nick,

This isn't something Blockly supports directly and I don't know of any guides explaining how developers add it. Several devs have done this, though, including Microsoft's MakeCode and Scratch Blocks. You could take a look at the changes Scratch Blocks has made to Toolbox as a starting point. They've added an additional parameter to the toolbox labels for an icon which they use when creating the dom.

Cheers,
Erik

Neil Fraser

unread,
Jan 8, 2018, 3:56:48 PM1/8/18
to blo...@googlegroups.com
From Blockly's end, you can unofficially access the tree like this:
  workspace.toolbox_.tree_

Good luck!


--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Nicholas Li

unread,
Jan 9, 2018, 10:33:28 AM1/9/18
to Blockly
Hi Erik,

Thanks for your answer, I will try to understand how to do that in Scratch 3.0~

Cheers,

~Nick

在 2018年1月9日星期二 UTC+8上午2:39:29,Erik Pasternak写道:
Message has been deleted

Nicholas Li

unread,
Jan 10, 2018, 10:31:59 AM1/10/18
to Blockly
Hi Fraser,

Thanks for your answer, it is very helpful for me.

Regards,

Nick

在 2018年1月9日星期二 UTC+8上午4:56:48,Neil Fraser写道:
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages