How to add default input

152 views
Skip to first unread message

bruh 9000

unread,
Mar 8, 2024, 10:10:05 AM3/8/24
to Blockly
I'm in Blockly Developer Tools and I can't figure out how to make it so that the input of a custom block will, by default, be filled in, as shown in the second attachment of the list block that is in Blockly's default library.
Screenshot 2024-03-08 070736.png
Screenshot 2024-03-08 070928.png

Aaron Dodson

unread,
Mar 8, 2024, 4:14:19 PM3/8/24
to Blockly
In this case, the reddish "item" dropdown is its own separate block of type "variables_get". The nesting is actually part of the toolbox configuration, e.g. https://github.com/google/blockly/blob/develop/tests/playground.html#L883-L889, and not part of the block definition. Your test block definition is fine; you'll need to either define a separate block to go in the empty spot, or reference one of the built-in blocks, when you define your toolbox, and then your users will see the test block with its nested block when they open the toolbox, and be able to drag them out as one unit.
Message has been deleted

bruh 9000

unread,
Mar 11, 2024, 3:47:28 PM3/11/24
to Blockly
Okay, thanks. How would I make that nested block to be a replaceable block that can be overwritten with another block?

Aaron Dodson

unread,
Mar 11, 2024, 4:59:15 PM3/11/24
to Blockly
It should be already - once it's dragged out of the toolbox, the user should be able to drag out the nested block or drop another in its place.

bruh 9000

unread,
Mar 11, 2024, 5:56:13 PM3/11/24
to Blockly
Okay, thanks
Reply all
Reply to author
Forward
0 new messages