beautypg.com

Registering for finds 16 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 613

background image

C H A P T E R 1 6

Find

Using the Find Service

16-25

The following code fragment shows how to use the

statusView

parameter to

display a progress message to the user:

MyAppplicationBase.Find:=

func(what, results, scope, statusView)

begin

if statusView then

statusView:SetMessage("Searching in" &

GetAppName(kAppSymbol)&

$/u2026);

...

end;

There are several ways to obtain the application name string that replaces the

appName

variable; they are listed here in order of recommended use:

You can retrieve this string from the

appName

slot in your application’s base view.

You can retrieve this string from the

title

slot in your finder frame.

You can retrieve this string by calling

GetAppName(kAppSymbol);

Registering for Finds

16

Applications registered with the Find service participate in Global finds; they also
participate in selective finds when specified by the user.

You do not need to register with the Find service to support Local finds. Global
and Local find support use the same mechanism, which relies on the

Find

and

ShowFoundItem

methods that your application supplies. A Global find is simply

a series of Local finds initiated by the system in applications that have registered
for participation in Global finds.

Use the

RegFindApps

function to register your application with the Find service

and its counterpart, the

UnRegFindApps

function, to reverse the effect. You

should call these functions from your application part’s

InstallScript

and

RemoveScript

functions.