Skip to Content
Learning Carbon
book

Learning Carbon

by Apple Computer Inc
May 2001
Intermediate to advanced
360 pages
10h 6m
English
O'Reilly Media, Inc.
Content preview from Learning Carbon

Moon Travel Planner: Displaying Localized Text

According to our specification (see Chapter 2), the Moon Travel Planner application needs a window, Facts for the Traveller, that displays facts about the moon to entice travelers to visit. The list of facts is a perfect candidate for a Localizable.strings file.

You’ll need to do the following to create the window:

  1. Create a new window to display the facts.

  2. Add a text field.

  3. Create a Localizable.strings file and add content for the window.

  4. Write a function to display the text.

  5. Modify the main window event handler so it handles the command that opens the facts window.

  6. Write a handler for the moon facts window. You need this handler to close the window. Later, you’ll need the handler to take care of print commands. (Recall that the specification calls for this window to be printable. You’ll write the printing code in Chapter 9.)

  7. Make sure text displays properly in the window.

Create a New Window

There are two ways you can use Interface Builder to create a new window: add a window to the existing main.nib file or create a new nib file for the window. In this section you’ll add a window to the existing nib file. Later, in Chapter 11 you’ll learn how to create a new nib file for a window.

  1. Double-click the main.nib file in the Moon Travel Planner project.

  2. Create a new window. Click the Windows button in the Palette toolbar. Then drag the window icon from the left side of the palette to the desktop, as shown in Figure 8.4.

  3. Name the window object ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

The Three Traps That Stymie Reinvention

The Three Traps That Stymie Reinvention

Ryan Raffaelli
Exploring GPT-3

Exploring GPT-3

Steve Tingiris
The Human Factor in AI-Based Decision-Making

The Human Factor in AI-Based Decision-Making

Philip Meissner, Christoph Keding
Cocoa Programming for OS X: The Big Nerd Ranch Guide

Cocoa Programming for OS X: The Big Nerd Ranch Guide

Aaron Hillegass, Adam Preble, Nate Chandler

Publisher Resources

ISBN: 0596001614Catalog PageErrata