beautypg.com

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

Page 794

background image

C H A P T E R 2 2

Transport Interface

22-6

Using the Transport Interface

Here is an example of installing a transport in the part

InstallScript

function:

InstallScript := func(partFrame,removeFrame)

begin
RegTransport(kAppSym, partFrame.partData.(kAppSym));
// assumes that partData.(kAppSym) holds the transport
end;

When your transport is removed, use the

UnRegTransport

function to unregister

the transport from the system. You pass the

UnRegTransport

function the

transport

appSymbol

like this:

RemoveScript := func(removeFrame)

begin
UnRegTransport(kAppSym);
end;

If your transport is scrubbed by the user from the Extras Drawer, the system
also calls the

DeletionScript

function in its package part. In the

DeletionScript

function, you should call the

DeleteTransport

function,

which removes user configuration information related to the transport. Here’s an
example of a

DeletionScript

function:

SetPartFrameSlot('DeletionScript,func(removeFrame)

begin
// delete prefs and other temporary data
DeleteTransport(kAppSym);
end)

Setting the Address Class

22

The transport object contains a slot,

addressingClass

, that holds a symbol.

This symbol identifies the class of the address information used by the transport,
such as that stored in the

toRef

and

fromRef

slots of an item. (See the section

“Item Frame” beginning on page 22-2.) The In/Out Box uses this symbol to look
up and display the to and from address information based on soup entries (usually
from the Names soup).

The class of address information is defined by name reference data definitions
registered in the system. You can specify one of the following built-in name
reference data definitions in the

addressingClass

slot:

'|nameRef.email|

, for use with a transport that handles e-mail

'|nameRef.fax|

, for use with a transport that handles fax phone calls

'|nameRef.phone|

, for use with a transport that handles other phone calls

Or you can specify a custom name reference data definition that you have created
and registered with the system. Note that all name reference data definitions must
be registered under a symbol that is a subclass of

'nameref

.