beautypg.com

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

Page 584

background image

C H A P T E R 1 5

Filing

15-18

Using the Filing Service

// now redraw views affected by the change

// NOTE: You could keep track of the original

//

labelsFilter and storesFilter to see

//

whether you need to actually do work.

end

Using the Folder Change Notification Service

15

You can use the

RegFolderChanged

global function to register callback

functions that are executed when the user adds, removes, or edits folders. Most
applications register these functions only while the application is actually open, so
the application base view’s

ViewSetupFormScript

is an ideal place from which

to call the

RegFolderChanged

function. For example,

myCallback1 := func(

oldFolder

,

newFolder

);

begin

// retag entries

end;

myAppBase.viewSetupFormScript := func ()begin

RegFolderChanged('|myFnId1:myApp:mySig|, myCallback1);

end;

The

UnRegFolderChanged

function removes a specified callback from use by

the folder change mechanism. Most applications unregister their folder change
callback functions when they close, making the application base view’s

ViewQuitScript

method an appropriate place to unregister folder change

callback functions. For example,

myAppBase.viewQuitScript := func ()begin

UnRegFolderChanged('|myFnId1:myApp:mySig|);

end;

Creating the doCardRouting slot

15

If you want to move items between stores from within the Filing slip, you need to
create a

doCardRouting

slot in your application’s base view. When an external

store is available and the value of this slot is non-

nil

, the Filing slip displays

buttons allowing the user to route the target to a specified destination store. If this
slot has a non-

nil

value but no external store is available, these “card-routing”

buttons are not displayed.