beautypg.com

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

Page 610

background image

C H A P T E R 1 6

Find

16-22

Using the Find Service

Your

FindSoupExcerpt

method may also extract extra information if the finder

frame has been set up to hold additional data. For example, if the date associated
with each found item was saved, you could use this information to build more
descriptive titles for overview items.

The following example shows the implementation of a simple

FindSoupExcerpt

method:

myApplication.FindSoupExcerpt:=

func(entry, myFinder)

begin

//We simply return the string in our entry’s name slot

entry.name;

end

For a complete description of the

FindSoupExcerpt

method, see

“FindSoupExcerpt” (page 13-19) in Newton Programmer’s Reference.

If you are using the

ROM_CompatibleFinder

proto, this finder must contain the

strings that a

ROM_SoupFinder

’s

FindSoupExcerpt

method would return. For

more information see the description of the

items

array in

“ROM_CompatibleFinder” (page 13-7) in Newton Programmer’s Reference.

The ShowFoundItem Method

16

This method locates the specified item in your application’s data and displays it,
performing any scrolling or highlighting that is appropriate. A typical

ShowFoundItem

method may need to

open a view appropriate for displaying the target

set the cursor or the

target

slot to reference the target

scroll the contents of the display view to make the target visible

highlight the target in the display view

The implementation of a

ShowFoundItem

method depends on which finder proto

you use. This section describes an example

ShowFoundItem

method suitable for

use with the

ROM_SoupFinder

proto.

If you’ve based your finder frame on the

ROM_SoupFinder

proto, the

ShowFoundItem

method is passed two arguments: the soup entry that

the user tapped in the Find overview, and the finder frame your application
added to the

results

array of finder frames.

The system expects your application’s

ShowFoundItem

method to look like the

following example:

ShowFoundItem: func(myEntry, myFinder) begin . . . end