beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 582

background image

C H A P T E R 1 5

Filing

15-16

Using the Filing Service

The arguments to the

FileThis

method supply all the information necessary to file

a soup entry, including the item to file (the target), the category under which to file
it (the value to which you set the target’s

labels

slot), and the store on which to

file it.

If the value of the

labelsChanged

parameter to the

FileThis

method is

true

,

your

FileThis

method must use the value of the

newLabels

parameter to

update the value of the target’s

labels

slot. However, if the value of the

labelsChanged

parameter is

nil

, the value of the

newLabels

parameter is

undefined—don’t use it!

Similarly, if the value of the

storesChanged

parameter is

true

, your

FileThis

method must move the target to the new store. However, if the value of

the

storesChanged

parameter is

nil

, the value of the

destStore

parameter

is undefined.

The following code example shows the implementation of a typical

FileThis

method. Remember to call

EntryChangeXmit

from this method so your changes

to filed entries are saved!

FileThis: // example code - your mileage may vary

func(target, labelsChanged, newLabels, storesChanged, destStore)

begin

if labelsChanged AND target.labels <> newLabels then

begin

target.labels := newLabels;

EntryChangeXmit(target, kAppSymbol);

end // labelsChanged

if storesChanged and (EntryStore(target) <> destStore) and

not destStore:IsReadOnly() then

begin

// move the entry to the new store & xmit change

// make sure you handle locked stores too

if EntryStore(target):IsReadOnly() then

EntryCopyXmit(target, destStore, kAppSymbol);

else

EntryMoveXmit(target, destStore, kAppSymbol);

end; //storesChanged

end; // FileThis

Implementing the NewFilingFilter Method

15

When the user changes the current filing filter in the folder tab view, the system
calls your application’s

NewFilingFilter

method. You need to define this

method in your application’s base view. Your

NewFilingFilter

method must

update the query that retrieves items matching the current filing category and