Apple Newton Utilities Guia do Utilizador Página 604

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 942
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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;
Vista de página 603
1 2 ... 599 600 601 602 603 604 605 606 607 608 609 ... 941 942

Comentários a estes Manuais

Sem comentários