beautypg.com

Routing items from the assistant 18 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 666

background image

C H A P T E R 1 8

Intelligent Assistant

18-20

Using the Assistant

2. Define an action template for opening the appropriate help book. The global

functions

ShowManual

and

OpenHelpTo

open the system-supplied help

book. The

OpenHelpBook

and

OpenHelpBookTo

functions open a help book

that you supply. The

ShowManual

function is described in “Utility Functions”

(page 26-1). All of these functions are described in version 1.1 of the Newton
Book Maker User’s Guide
.

3. Define a task template that holds the name of your action template as the value

of its

primary_act

slot.

4. Register and unregister the task template at the appropriate times.

For information on defining, registering, and unregistering templates, see the
preceding section, “Making Behavior Available From the Assistant” (page 18-15).

For information on displaying online help from an information button that
your application provides, see “protoInfoButton” (page 6-10) in Newton
Programmer’s Reference
.

Routing Items From the Assistant

18

When routing an item from the Assistant—for example, when filing, faxing,
printing, or mailing the item—the Assistant sends a

GetTargetInfo

message to

your application. The root view supplies a default

GetTargetInfo

method that

returns information such as the item to be routed and the view that is able to
manipulate it. This method relies on

target

and

targetView

slots supplied by

your application’s base view. You can define your own

GetTargetInfo

method

if you need to supply different target information. For more information, see
“Specifying the Target” (page 15-13). For detailed information on supporting
routing in your application, see “Routing Interface” (page 21-1).

Normally the

GetTargetInfo

message is sent to the application’s base view;

however, such behavior may not be appropriate for applications having more than
one view with user data. For example, the built-in Notepad application can display
multiple active Notes.

To specify that the

GetTargetInfo

message be sent to a view other than your

application base view, your application’s base view must provide a

GetActiveView

method that returns the view to which the

GetTargetInfo

message is sent. The

GetTargetInfo

message is sent to the view specified by

the return result of the

GetActiveView

method.