beautypg.com

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

Page 608

background image

C H A P T E R 1 6

Find

16-20

Using the Find Service

limit a Find operation to certain data sets of an application. For example, a personal
finance program may have a check ledger, an account list, and a credit card charges
list. Another example is an online sales catalog program that could allow users to
separately search different catalogs. Even though a single application is receiving
the

Find

message, a Selected find operation from the Find slip allows the user to

designate any or all of the associated data sets for the Find operation.

To enable multiple data sets in a find operation, first add the method

AppFindTargets

to your application’s base view. This method must return an

array of frames that specify the data sets for the application. These data set frames
consist of a

name

and

target

pair of slots for each data set, in the following form:

[{name: "

userVisibleText

", target:

thisDataForYourUse

}, {...}]

The

name

slot of the data set frame holds the string to be displayed in the picker

which displays when the Find slip’s Selected button is tapped. The

target

slot, of

the data set frame, can be set to anything; it is passed to your

FindTargeted

(or

DateFindTargeted

) method. There may be any number of these data set frames

included.

An example

AppFindTargets

method may be defined as follows:

MyApplicationBase.AppFindTargets: func()
begin

[{name:"Check Book", target:'check},
{name:"Accounts", target: 'accounts},
{name "Credit Cards", target:'credit}];

end;

You must then add the search methods to your finder frame. These methods
leverage from the built-in

Find

and

DateFind

methods, adding the data set you

refer to in the

target

slot as an additional parameter. You define a

FindTargeted

method as shown in the following example:

MyApplicationBase.FindTargeted:
func (what,sysResultArray,scope, statusView,target)

// N.B. Scope for Selected find is always 'globalFind

begin

local mySoup;
// Assume the target parameter is the name of the
// soup to search... (We provided this value in
// base.AppFindTargets.)

// Must include the following line... See “Using the
// StandardFind Method.”
local temp := GetUnionSoupAlways(target)
:StandardFind( what, target, sysResultArray,

statusView, 'text);

end;