Moon Travel Planner: Creating a Project

Let’s get some practice with Project Builder by creating a project from a Carbon application template, then building and running it. You’ll create a new project for the Moon Travel Planner application we specified in Chapter 2. When you’re done, you’ll have an application that displays an empty window and lets you quit.

To create the Moon Travel Planner project, do the following:

  1. Double-click the Project Builder icon located in Mac OS X in the directory /Developer/Applications. The first time you open Project Builder, the Project Builder Assistant opens. You’ll need to complete the setup process before you can proceed with the next step.

  2. Choose New Project from the File menu. A dialog opens with a list of template objects, as shown in Figure 3.12.

    Choosing the type of project

    Figure 3-12. Choosing the type of project

  3. Select Carbon Application (Nib Based), then click Next. Nib refers to a project that uses Interface Builder to create user interface resources. You’ll use Interface Builder later to modify the default interface you get with the project.

  4. Type Moon Travel Planner as the project name (as shown in Figure 3.13) and click Set to choose a location to store the project. A sheet appears that lets you navigate to the location you want to store the project.

  5. Click Finish. The main window for Project Builder opens, with files for our new application in the Groups & Files list. Believe it or not, you now have a complete, although skeletal, application!

  6. Take a look at the main function by clicking main.c in the Groups & Files list. If you can’t see the main.c file, click the Files tab and open the Sources group. You should see the same code shown in Example 3.1.

Specifying the project location

Figure 3-13. Specifying the project location

Building and Running the Skeletal Application

The code should run without modification. Let’s see if it does!

  1. Click the Build button in the upper-left corner of the project window. The Build pane appears. When the build finishes, a message appears at the bottom of the project window. As long as you have not changed the source files, you should see the message “Build succeeded.”

  2. Click the Run button in the upper-left corner of the project window. Project Builder launches the application; the application displays an empty window.

    Note

    A shortcut is to press Shift-R to build and run the application. To avoid having Project Builder ask if you want files saved before building, set Project Builder’s preferences to Always Save. To set this preference, choose Preferences from the Project Builder menu, click the Building icon, then choose Always Save from the Unsaved Files pop-up menu.

  3. Press Command-Q to quit the sample application.

  4. Choose Save from the File menu to save your project. You won’t need to do this if you’ve set preferences to Always Save.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.253.223