How to define the callbacks as I have created a button in toolbox but it is showing error.

315 views
Skip to first unread message

Vivek

unread,
Apr 13, 2018, 7:43:11 AM4/13/18
to Blockly
Hi team,

I have created a button in toolbox as defined in the doc. And also provided the callback key button attribute.
While running it is showing an error in console that :-Button should have callbacks

<category name="Variables" colour="#F89E35">
     <button text="Create Variable" callbackKey = "myFirstButtonPressed"></button>
     </category>


But I don't know where to define the callback "myFirstButtonPressed".

Scenario I want:-
When I click on button then it should ask for 2 inputs from user by prompt and then generate a block in toolbox if user provides both inputs.

Thank You

Andrew n marshall

unread,
Apr 13, 2018, 1:37:10 PM4/13/18
to blo...@googlegroups.com
Glad to see you've found the toolbox button documentation.

As noted, register your button callback with workspace.registerButtonCallback(..).

--
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.

Reply all
Reply to author
Forward
0 new messages