Page 158 - The Ultimate Palm Robot
P. 158

Color profile: Generic CMYK printer profile
           Composite  Default screen
                                                          Bots /The Ultimate Palm Robot/ Mukhar & Johnson / 222880-6 / Chapter 6






                                                      Chapter 6  The Palm Robot Programmer (PRP)     141



                                    The Workspace

                                    The biggest piece of the PRP interface is taken up by the workspace, which is
                                    used to build up your program block by block. As you saw earlier, you build
                                    programs by selecting components from the palette and adding them to the
                                    workspace.

                         Adding a Component
                                    We showed you how to add components to a program when we built the sam-
                                    ple program earlier in the chapter. In this section, let’s see some of the finer
                                    points of this action.

                                      As we saw earlier, adding a component to a program can be as simple as
                                    clicking a component in the palette and then clicking on a component in the
                                    workspace. When you do this, the new component is added to the program in
                                    a position that follows the component you clicked.

                                      Some components, however, can contain other components. These compo-
                                    nents are the If, Else, While, For, Main, and Subroutine components. When
                                    these blocks are added to the program, the PRP automatically adds an EndIf,
                                    EndElse, EndWhile, EndFor, EndMain, or EndSubroutine block.
                                      When adding a program block, if you click the block that begins one of
                                    those components listed earlier, the new block is added between the compo-
                                    nent and its corresponding end block. Thus it becomes part of the code section
                                    contained by the component. For example, program blocks added between If
                                    and EndIf will be executed only when the condition of the If block is true.
                                    When the If section also contains an Else block, program components between
                                    Else and EndElse will be executed when the condition of the If block is false.

                                    NOTE:   The PRP will not stop you from adding program blocks between the
                                    EndElse and EndIf blocks. However, if you do so, your program may not
                                    work correctly.
                                      If you click the workspace—not an existing component—while adding
                                    a new component, the PRP will usually ignore the mouse click, because it
                                    doesn’t want to guess where you want the component to be located.

                         Deleting and Pasting Components
                                    To delete a component from a program, simply click the component in the
                                    workspace, and choose Edit | Cut or Edit | Delete, or click the corresponding










           P:\010Comp\Bots\880-6\ch06.vp
           Monday, May 12, 2003 1:06:25 PM
   153   154   155   156   157   158   159   160   161   162   163