beautypg.com

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

Page 758

background image

C H A P T E R 2 1

Routing Interface

21-10

Using Routing

Getting and Verifying the Target Object

21

When the user first taps the Action button, but before a choice is made from the
picker, the Routing interface sends the Action button view the

GetTargetInfo

message, passing the symbol

'routing

as a parameter. The purpose of this

message is to get the target object to be routed and the target view in which it
resides. Usually, these items are stored in slots named

target

and

targetView

in your application. If you set up and use such slots in your views, you don’t need
to implement the

GetTargetInfo

method because this is a root view method

that is found by inheritance. The root view method simply looks for the slots

target

and

targetView

, starting from the receiver of the message, which is the

Action button view. It returns these slots in a frame called the target information
frame. If you don’t use these slots in your views, you’ll need to implement the

GetTargetInfo

method to return them.

You’ll need to implement the

GetTargetInfo

method if the user has selected

multiple items to route. In this case, you’ll need to construct a single object that
encapsulates the multiple items selected for routing, because the target must be a
single object and it can’t be a standard cursor. In your

GetTargetInfo

method

you can use the function

CreateTargetCursor

to create a multiple-item target

object from the selected items.

Note

In most cases the target object is a frame. In some cases you
might want to route a nonframe object such as a string or binary.
The Routing interface supports nonframe target objects; however,
other system services such as Filing may require target objects
that are frames, so you may not be able to use the same target
with them. Note also that nonframe target objects must have a
meaningful class for use with the Routing interface.

Once the user chooses a transport-based routing action from the Action picker, the
system creates a new item frame containing some default slots and values for the
target item. This is done by means of the transport method

NewItem

. One slot that

is initialized by

NewItem

is the

appSymbol

slot of the item frame. The value for

this slot is obtained from the

appSymbol

slot of the application doing the routing

(through inheritance from the Action button view).

Then, just before the routing slip is opened, the Routing interface sends the
message

VerifyRoutingInfo

to the view identified by the

appSymbol

slot in

the item frame. This is normally your application base view. However, if you are
doing routing from a view created by

BuildContext

, for example, the

appSymbol

slot might be missing because such views don’t automatically include

this slot. You must include an

appSymbol

slot in such a view, if you need to use

the

VerifyRoutingInfo

message, since the

appSymbol

slot determines where

this message is sent.