beautypg.com

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

Page 680

background image

C H A P T E R 1 9

Built-in Applications and System Data

19-6

Names

The

bizCardIcon

slot contains an icon representing the new layout, to be shown

in the Card Style view, where the user can change the type of card layout to use for
a particular card. This icon should be 38x23 since this is the size of the built-in icons.

Adding New Layouts to the Names Application

19

The Show picker allows the user to chose from the two built-in layouts: Card and
All Info. You can programmatically add a new layout by calling the Names method

AddLayout

. It takes a single parameter, which is the layout to add. This layout

should be based on the

newtLayout

proto, and must include the following slots:

name

A string shown in the Show picker.

symbol

A symbol, which includes your developer signature, uniquely
identifying this layout. This symbol must be passed to the

EnsureInternal

function.

type

Set this slot to the symbol

'viewer

.

protection

Set this slot to the symbol

'private

.

For more details see

AddLayout

(page 16-8), and its counterpart function

SafeRemoveLayout

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

Using the Names Methods and Functions

19

There are a number of methods provided by the Names application. To obtain a
reference to the Names application in order to send these methods, use the
following code:

GetRoot().cardfile

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

if GetRoot().cardfile then ...

The methods provided allow you to

add a new card (

AddCard)

add data to an existing card (

AddCardData

)

turn to a particular card if Names is open (

ShowFoundItem

)

open the Names application to a particular card (

OpenTo

)

replace ink data in a card with a string (

ReplaceInkData

)

add an action to the Action picker (

RegNamesRouteScript

)