Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 714

Advertising
background image

C H A P T E R 1 9

Built-in Applications and System Data

19-40

Icons and the Extras Drawer

Using Extras Drawer Cursors

19

The Extras Drawer method

GetPartCursor

creates a cursor that can iterate over

parts (icons) in the Extras Drawer. You can create a cursor that iterates over parts in
a specific store, a particular folder of the Extras Drawer, a particular package, or a
combination of these criteria. This cursor is a normal soup cursor, as described in
Chapter 11, “Data Storage and Retrieval.”

Entries returned by part cursors are subject to change. These entries should be
manipulated only with one of the following three Extras Drawer methods:

GetPartEntryData

returns information about a part.

LaunchPartEntry

has the same effect as the user tapping the icon.

SetExtrasInfo

sets data in a part entry; see “Changing Icon Information.”

Changing Icon Information

19

The Extras Drawer method

SetExtrasInfo

can be used to change the icon or

text under an icon. It can also change the

labels

slot of an icon, which has the

effect of filing the icon. If the icon is a soup icon, you may also change the array of
soups that this icon represents and the application that owns these soups.

Adding a Soup Icon

19

If your application uses more than one soup or you want to file or move entire
soups through the soupervisor mechanism, you should consider using a soup icon,
so that only one icon appears in the Extras Drawer. You should store this icon in the
internal store, otherwise all the component soups will reappear when the external
store is removed. Also, you should give the icon a different package name from
your application in your call to

AddExtraIcon

, both as the pkgName parameter

and in the

app

slot of the paramFrame parameter. Again, this is so that it is not

removed when your application is.

You add a soup icon to the Extras Drawer by calling its

AddExtraIcon

method.

Passing the symbol

'soupEntry

for the first parameter specifies that the icon to

add is a soup icon.

The rest of this section provides sample code for installing a soup icon. Before
trying to understand this code, you should read the description of

AddExtraIcon

(page 16-88) in Newton Programmer’s Reference.

//Useful constants

constant kMySoupNamesArray := '["soup1:NDTS",

"soup2:NDTS", "soup3:NDTS" ];

constant kMySoupUserName := "Souper Thing";

DefConst('kSoupPackageName, "Soups:" & kPackageName);

Advertising