Tips for writing Blockly Programs

This page is work in progress.

We provide here tips based on our experience of using Blockly.

  1. 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.
  2. The key combination CTRL+Z can be very useful for reverting to the situation before unwanted changes.
  3. 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.
  4. 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).
  5. 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.
  6. The scale changes achieved by clicking on the + and - icons are very impressive. It is possible (but more difficult) to work with tiny blocks.
  7. 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.
  8. To move a group of blocks, drag the top block of the group.
  9. 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.
  10. The Home and End buttons are often useful when editing a long string of text in a block.
Programming - a skill for life!

A generator to help you to code in Smart Pascal