How to Create MicroWorld EX Buttons to Execute Primitives

By Camille McCue

The MicroWorld EX Command Center is a good place to test out commands as you develop a program. But users of your program don’t want to type in commands! Users want a simple way to operate your program.

You operate your television, phone, and computer through a graphical user interface (also called a GUI), which has buttons, pictures, menus, and other tools for communicating with each device. MicroWorlds EX provides ways for you to build your own GUI to make it easy for people to use your computer program.

Instead of asking a user to type in a command such as setbg “red to change the workspace of the Art Toy to the color red, you can make a button to do the work instead. To create a button, you provide two pieces of information: a label for the user, and an instruction for the computer.

Make a button to change the background color of the workspace as follows:

image0.jpg

  1. From the toolbar, click the Create a Button button. Then click anywhere in the workspace.

  2. In the Button dialog box, fill in the following information as you see in the example:

    image1.jpg

    • Label: Type Red Background in the Label text box. These are the words the user will see on the button.

    • Instruction: Type setbg “red into the Instruction field. The command that you enter in the Instruction field — setbg “red — will be executed when the player clicks the button.

    • Do It: Select the Once radio button. This means that the instruction will be executed one time when the button is clicked.

    • Visible: Select this check box to leave the button visible on the screen.

  3. Click OK to close the Button dialog box.

    The completed Red Background button on the left in the example is added to the workspace.

    image2.jpg

  4. The button doesn’t show all the words, so resize the button to show the entire label. Ctrl-click (Windows) or Command-click (Mac) the button. Sizing dots appears in the center — click and drag any of them to resize the text box as you can see on the right.

  5. Position the completed button by dragging it to any location in the workspace.

  6. To make sure that people playing with your Art Toy don’t accidentally move your buttons or text boxes, right-click (Windows) or Ctrl-click (Mac) any button or text box and select Freeze from the pop-up menu to freeze it in place.

  7. Repeat Steps 1–6 to create buttons for all the primitives you have learned so far.

    Be creative by using any colors, distances, and turn angles you want! On some of the buttons, try setting the Do It radio button to Forever so that the button command executes over and over (until you click the button again to halt the execution, or click the Stop All button on the toolbar). Executing the button instructions forever will produce interesting effects for forward, backward, turn, and random instructions.

  8. Play with your toy to create a unique digital work of art.

    Your Art Toy now looks something like this.

    image3.jpg