beautypg.com

Creating a new type of format 21, Providing application-specific routing actions 21 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 770

background image

C H A P T E R 2 1

Routing Interface

21-22

Using Routing

// which takes targetInfoFrame.target and makes an

// alias, if appropriate

end,

TextScript: func(item,target) begin . . . end,

...

};

Note that one application can have multiple frame formats. You would simply
supply a different

SetupItem

method for the different formats (as well as unique

symbol

and

title

slots), to construct the item frame differently.

If your frame format doesn’t support the

'text

data type, you should override the

dataTypes

slot and set it to

['frame]

.

For routing formats that support the

'text

data type, you must override the

default

TextScript

method that obtains the string data, if there are no data

definitions for the data that contain their own

TextScript

method.

For more information about the slots and methods provided by this proto, see
“Routing Format Protos” (page 18-9) in Newton Programmer’s Reference.

Creating a New Type of Format

21

You create a new type of routing format by using

protoRoutingFormat

. This is

the base routing format, which serves as a proto for the other routing format protos.

Here is an example of a format based on this proto:

MyNewFormat := {

_proto: protoRoutingformat,

dataTypes: ['binary],

symbol: '|myFormat:SIG|,

title: "Custom",

SetupItem: func(item, targetInfoFrame) begin

call kMyFunkySetup with (item, targetInfoFrame);

end,

...

};

For more information about the slots and methods provided by this proto, see
“Routing Format Protos” (page 18-9) in Newton Programmer’s Reference.

Providing Application-Specific Routing Actions

21

First, to provide the Action button in the user interface of your application, you
must include a view based on the

protoActionButton

proto. For details, see

protoActionButton

(page 18-7) in Newton Programmer’s Reference.