Backpack: Copy and Paste Blocks to Different Screens and Projects

The Backpack allows you to carry around blocks throughout your project repositories, allowing blocks to be transferred between projects and between screens.  The contents of the Backpack persist throughout an App Inventor session. Since late January 2017, the Backpack contents persist across logins. When you login to MIT App Inventor, you will find the blocks you left from your last session.

Click here for a video demo.

How does Backpack work?

The Backpack is a copy-and-paste feature that works between projects and screens. The Backpack icon is located at the upper-right corner of the workspace.

Copying Blocks. Blocks from the workspace can be dragged and dropped into Backpack. This is the copy operation -- the blocks are copied (duplicated) in the backpack.  When blocks are dropped into the Backpack, an animation and sound will occur to confirm for the user that the operation was successful.

Viewing the Backpack Contents. The contents of the Backpack can be viewed by clicking on the its icon (upper right corner of the workspace).  A scrollable flyout will pull out from the right edge of the workspace, displaying the Backpack’s contents. The flyout of the Backpack works the same way as the flyouts in the Block drawers.

To close the flyout without pasting any blocks, you can click the workspace or click any empty space in the Backpack with no block highlighted. Note that if you click on a highlighted block in the flyout, that block will be pasted to the workspace.

Pasting Blocks.  Blocks can be pasted from the backpack into the current workspace by clicking on the Backpack icon (upper right corner of the workspace) and dragging the block from the flyout to the desired location in the workspace.  

As long as you do not close App Inventor, the blocks in the Backpack will be transferrable throughout your project repository and to other screens within the current project. When you refresh the browser, a new session of App Inventor will begin and the Backpack will be empty.  

Background Menus

In addition to the drag-and-drop functionality, a right-click on background menus on the blocks and on the workspace can be used to perform Backpack functions -- as shown in the following image.

           Screen Shot 2015-07-19 at 11.56.36 PM.png

               [right click on a block]                        [right click on the workspace]                    

Right Click on Block

Right Click on Workspace Background

What can be added to Backpack?

 

Initializations that duplicate existing blocks in the destination workspace will be automatically renamed.  For example, if you try to paste a variable initialization block for global variable X and the workspace already contains an initialization block for X, the variable will be renamed X2 in the pasted block.

Similarly, if you try to paste a procedure definition for procedure foo and the workspace already contains a definition of foo, the pasted procedure will be renamed foo2.

Can you paste blocks into any project or screen?

Yes. However, there are instances when pasting blocks from the backpack to a new project or screen will cause red error triangles  to be raised.  For example, this will occur when a block refers to a non-existent variable or procedure in the destination project. The errors can be removed (fixed) by defining the missing variable or procedure.  It will also occur when a block refers to a non-existent component in the destination project.  The errors can be removed (fixed) by adding the missing component and giving it the same name as the one referred to in the pasted block.