beautypg.com

Providing transport-based routing actions 21 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 757

background image

C H A P T E R 2 1

Routing Interface

Using Routing

21-9

send items programmatically

receive items

allow items to be viewed in the In/Out Box

Providing Transport-Based Routing Actions

21

Here’s a summary of the minimum things you need to do to support routing by the
Action button in an application:

Include the Action button in your application (or in individual views) by adding
a view based on the

protoActionButton

proto.

Supply a

GetTargetInfo

method in your application (or in individual views)

or ensure that the

target

and

targetView

slots are set up correctly with the

target object and target view, so the system can determine what is being routed.

Ensure that the target data object has a meaningful class (for frame objects, this
is the

class

slot). The data class is used to determine the appropriate formats,

and thus transports, available to an item.

Create one or more routing formats, using one of the routing format protos. Give
your formats unique

symbol

and

title

slots, and supply the

SetupItem

method, if necessary. View formats may need a

PrintNextPageScript

method for multiple pages, and may need a

FormatInitScript

method if

much preparation must be done before printing or faxing. Text formats may
need a

TextScript

method.

Register your routing formats in the application part

InstallScript

function

and unregister them in the

RemoveScript

function.

To support routing through transports, your application uses one or more routing
formats. These may be custom formats registered by your application or other
formats built into the system or installed separately. For more information about
routing formats, see the section “Routing Formats” beginning on page 21-5. There
are some prototype formats built into the system that you must use to create your
own formats:

To create a format for routing a

'view

data type, use the

protoPrintFormat

; see “Creating a Print Format” (page 21-18).

To create a format for routing

'frame

and

'text

data types, use the

protoFrameFormat

; see “Creating a Frame Format” (page 21-21).

To create a new kind of format for data types other than

'view

or

'frame

, you

can use the

protoRoutingFormat

; see “Creating a New Type of Format”

(page 21-22).

The following sections describe the more detailed aspects of supporting transport-
based routing.