Apple Newton Utilities Betriebsanweisung Seite 604

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 942
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 603
CHAPTER 16
Find
16-16 Using the Find Service
Using Your Own Text-Searching Method 16
The following code example illustrates the kinds of tasks you must perform when
the
StandardFind method is not used. (However, it is strongly suggested that
you use the
StandardFind method to implement your Find routine, if possible.)
This example searches for text in soup-based application data using the
ROM_SoupFinder proto:
// This routine MUST be named Find; it is called by
// the system when the user chooses Find.
MyApplicationBase.Find :=
func(what, results, scope, statusView)
begin
local myFinder;
// Report status to the user;
// note use of GetAppName and Unicode ellipsis.
if statusView then
statusView:SetMessage("Searching in " &
GetAppName(kAppSymbol)& $\u2026);
// Presume our soup def is registered,
// however, app may be closed so get our own soup.
local mySoup:= GetUnionSoupAlways("My Soup");
// Make sure a member soup exists so query won’t
// fail (GetMember creates the soup if necessary).
mySoup:GetMember(GetDefaultStore());
//Retrieve entries with strings beginning with "what".
local myCursor := mySoup: Query({text: what});
// Append finder to system-supplied results array
if cursor:Entry() then
begin
myFinder :=
{
_proto: ROM_SoupFinder,
owner: self,
title:"My Application",
findType: 'text,
findWords: :MyStringSplittingFn(what),
cursor: myCursor,
};
AddArraySlot(results, myFinder);
end;
end;
Seitenansicht 603
1 2 ... 599 600 601 602 603 604 605 606 607 608 609 ... 941 942

Kommentare zu diesen Handbüchern

Keine Kommentare