Tips for writing Blockly Programs
This page is work in progress.
We provide here tips based on our experience of using Blockly.
- Work in Chrome to be on the safe side. (We have had crashes of Blockly with Microsoft Edge but none with Chrome). We save XML regularly to a text file.
- The key combination CTRL+Z can be very useful for reverting to the situation before unwanted changes.
- When importing blocks from XML, these will be added to the current blocks. You usually want to refresh the screen to clear it before importing.
- Renaming a variable works well and changes all occurrences. You might find introduced variables that you do not want such as x, text and list. You can rename these to identifiers you need or delete them. (Double clicking on a variable puts it onto the workspace then a right click gives you its drop-down menu).
- You can give a procedure or function a comment by clicking on the ? icon. If you remove the default comment ("Describe this function...") it will not show up on the XML or Smart Pascal output, but will reappear the next time the blocks are imported into Blockly.
- The scale changes achieved by clicking on the + and - icons are very impressive. It is possible (but more difficult) to work with tiny blocks.
- You can drag the workspace around with the mouse. Do not work with blocks close to the + and - icons or your clicks may not do what you intend.
- To move a group of blocks, drag the top block of the group.
- To copy a block or group, select it and press CTRL+C then CTRL+V. It can be quicker to copy and edit than start again from the toolbox.
- The Home and End buttons are often useful when editing a long string of text in a block.