Adding the code window to an existing app

81 views
Skip to first unread message

HR Myler

unread,
Mar 12, 2022, 11:03:24 AM3/12/22
to Blockly
Note the code window (and language pulldown) below:
Blockly Code Window.jpg

Is there any way to make this appear in an app that has an embedded Blockly coder but does not display the code window? (see below). The package for the app includes the various language javascript modules.

screen_01.jpg

Aaron Dodson

unread,
Mar 14, 2022, 4:55:07 PM3/14/22
to Blockly
The code area and language picker are not part of the core Blockly distribution. You can emulate it in your app by calling Blockly.JavaScript.workspaceToCode(Blockly.getMainWorkspace()), which returns the text-based representation of the current blocks, which you could e.g. insert into a <textarea>.

- Aaron

HR Myler

unread,
Mar 14, 2022, 5:13:58 PM3/14/22
to Blockly
Could that be put into one of the js modules in the executable package? I do not have access to the original source, which I think is C#.

Aaron Dodson

unread,
Mar 15, 2022, 11:21:22 AM3/15/22
to Blockly
Yes, that should work; if you can access and modify the JS for Blockly bundled in the app, the code I mentioned should in all likelihood work fine.

HR Myler

unread,
Mar 15, 2022, 5:22:21 PM3/15/22
to Blockly
Thanks. Is 'how this works' documented anywhere? I am guessing at this stage that when the app that has Blockly embedded in it runs, it loads the Blockly js files as needed like a DLL.
Reply all
Reply to author
Forward
0 new messages