Apple Newton Utilities Guide de l'utilisateur Page 606

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 942
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 605
CHAPTER 16
Find
16-18 Using the Find Service
// We may also add slots here...
};
// Append myFinder frame to system’s results array
AddArraySlot(results, myFinder);
end;
Implementing the DateFind Method 16
Date-based searches have a lot in common with their text-based counterparts; in
fact the only signicant difference between these two operations is the search
criteria. Rather than matching a text string, the
DateFind method tests items
against a time value according to the value of the
findType parameter. This
parameter indicates whether the search should include results for items dated on,
after, or before a specied date.
You can simplify the implementation of date-based searches by time-stamping your
application’s data when it is stored. If you store application data as frames that hold
the time they were created or modied in a particular slot, the
DateFind method
simply tests the value of this slot to accept or reject the entry.
The sample code immediately following shows the implementation of a typical
DateFind method using the ROM_SoupFinder proto. This code assumes that
soup entries have a
timeStamp slot:
MyApplicationBase.DateFind :=
func(findTime, findType, results, scope, statusView)
begin
local myCursor ;
local querySpecFrame;
local querySpec;
local ourFinder;
local mySoup;
constant kOneDay := 60*24;
// report status to the user
if statusView then
statusView:SetMessage("Searching in " &
GetAppName(kAppSymbol) & $\u2026);
// Get the soup
mySoup:= RegUnionSoup(kAppSymbol, kSoupDef);
Vue de la page 605
1 2 ... 601 602 603 604 605 606 607 608 609 610 611 ... 941 942

Commentaires sur ces manuels

Pas de commentaire