Apple Newton Utilities User's Guide Page 605

  • Download
  • Add to my manuals
  • Print
  • Page
    / 942
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 604
CHAPTER 16
Find
Using the Find Service 16-17
Finding Text With a ROM_CompatibleFinder 16
The following example shows how to use the ROM_CompatibleFinder proto to
search for text in application data that is not soup based. The sample code
immediately following doesn’t contain code that actually searches application data,
because the implementation of such a search would be specic to the data type
used to store the application data.
MyAppplicationBase.Find:=
func(what, results, scope, statusView)
begin
local item, foundItems, massagedFoundItems, myFinder;
// Set the message in the Find slip.
if statusView then
statusView:SetMessage("Searching in " &
GetAppName(kAppSymbol) & $\u2026);
// MyFindMethod does the actual searching, since
// this is too app-specific to do here. It returns
// an array of all the data items that match 'what.
foundItems := MyFindMethod(what);
// Now we create an array with frames of the form
// mandated for ROM_CompatibleFinder.
massagedFoundItems :=
foreach item in foundItems collect
{
// Use proto inheritance to protect data
_proto : item,
// This is seen by the user in the Overview
// (pretend our data is frames w/'name slots)
title : item.name,
// We may add any other slots here our
// methods may want later
};
// Construct the finder frame.
myFinder :=
{_proto: ROM_CompatibleFinder, // For non-soup data
owner: self,// View receiving ShowFoundItem message
title: "My App",
items: massagedFoundItems,
findType : 'text,
findWords: :MyStringSplittingFn(what),
Page view 604
1 2 ... 600 601 602 603 604 605 606 607 608 609 610 ... 941 942

Comments to this Manuals

No comments