beautypg.com

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

Page 600

background image

C H A P T E R 1 6

Find

16-12

Using the Find Service

The full complement of slots in the finder frame resulting from your searches
varies according to the finder proto it’s based on. A finder frame based on the

ROM_SoupFinder

proto returns a finder containing a cursor with which to

retrieve found items from the application soup. A finder frame based on the

ROM_CompatibleFinder

proto results in a frame containing an array of the

actual found items.

The

ROM_CompatibleFinder

proto is meant to serve as a guideline for creating

a finder that works on a data storage set that does not use soups. The methods
included must be overridden to fit the data type in which your application data
is stored.

Several methods and slots are included by both system protos; they include:

The

selected

array stores selected items from the Find overview in an

internal format. All you can do is pass the array to the

Length

function to

determine the number of selected items.

The

Count

method returns an integer with the total number of found items.

The

Resync

method resets the finder to the first found item.

The

ShowFoundItem

method displays the overview data item that resides in

the overview’s items array.

The

ShowOrdinalItem

method displays an item based on the ordinal number

or symbol (

'first

,

'prev

, or

'next

) passed to it.

Whenever possible, you should store your application’s data in soups and use the

ROM_SoupFinder

proto to support the Find service, as shown in the following

code fragment:

if cursor:Entry() then begin

myFinder := {

_proto: ROM_SoupFinder,

owner: self,

title:"My Application",

findType:'text, //other possible values are

//'dateBefore,'dateOn, and 'dateAfter

findWords: [

searchedForTheseStrings

],

cursor: myCursor,};

Table 16-1 provides quick reference descriptions of the

ROM_SoupFinder

methods. Most should not be overridden, but those that may be are indicated.