beautypg.com

Using the time zone application 19 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 702

background image

C H A P T E R 1 9

Built-in Applications and System Data

19-28

Time Zones

Using the Time Zone Application

19

The application program interface provides functions for retrieving information
about cities and countries, a method to add a city to a Newton device’s list of cities,
and a method to set the home city. To call a Time Zones method, you need a
reference to the application. To obtain this reference, use the following code:

GetRoot().worldClock

Note that future Newton devices may not include the Time Zones application. You
should therefore check for the existence of the Time Zones application before
trying to access it. Use the following code to test for this:

if GetRoot().worldClock then ...

Obtaining Information About a City or Country

19

The

GetCityEntry

and

GetCountryEntry

global functions return information

about a number of cities and countries around the world. This information is
available to the user by picking All Info from the Show picker, shown in Figure 19-5.

Figure 19-5

Time Zones application’s All Info view

Both these functions take a string as an argument for the city or country to return
information about. The search is conducted by string comparison with this
argument. You should be aware that although there may be variations of the name
of a city or country, only one name is stored on the Newton device. For example,

GetCityEntry("Los Angeles")

returns a frame with information about Los

Angeles, but

GetCityEntry("LA")

does not. You should check the spelling in

the Time Zones application of city or country names you wish to use. Keep in mind