background image
C H A P T E R 1 6
Find
Using the Find Service
16-23
In the body of this method, you need to do whatever is necessary to display the
soup entry
myEntry
. Typically, you first send a
Close
message to the Overview
and then open the view that displays the entry. The following code fragment shows
the implementation of a typical
ShowFoundItem
method.
// For use with ROM_SoupFinder proto
myApplication.ShowFoundItem:=
func(entry, myFinder)
begin // close my overview if it's open
if currentView = myOverview then begin
myOverView:Close();
myDisplayView:Open();
// open view that displays the entry
end;
// scroll, highlight, etc. as necessary
// to display the entry
myDisplayView:DisplayEntry(entry, cursor);
end
Your application is always open when the
ShowFoundItem
message is sent to it.
For example, this message is sent when the user scrolls between found items from
within the Find slip. The system also invokes this method when the user taps an
item in the Find overview. In this case, the system opens your application, if
necessary, before sending the
ShowFoundItem
message to it.
Note that if no items are found this message is never sent.
Using ShowFoundItem with ROM_CompatibleFinder
16
If you are using a finder based on
ROM_CompatibleFinder
, you still need to
implement a
ShowFoundItem
in your application's base view. Your finder also
needs to override the
ShowFakeEntry
method. Your
ShowFakeEntry
method
needs to call your
ShowFoundItem
method, making sure that your application is
open first. Your
ShowFoundItem
method should accept an element of the finder's
items
array as its first parameter, instead of a soup entry. It should perform the
same actions as a
ShowFoundItem
method that expects a soup entry, as described
in "The ShowFoundItem Method" (page 16-22).
The following example demonstrates a typical
ShowFakeEntry
method:
myFinder :=
{
_proto : ROM_CompatibleFinder,
ShowFakeEntry : func (index)
begin
local myApp;
if myApp := GetRoot.(kAppSymbol) then
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна