beautypg.com

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

Page 161

background image

C H A P T E R 4

NewtApp Applications

Using NewtApp

4-23

Certain slots must be added to these base view slots for your application to be able
to utilize the false entry view and the slot views. First, you must be sure to add a

target

slot and

targetView

slot, so that the false entry view can set them when

an entry is changed. Second, you should include a method that sends the

Retarget

message to the false entry view when an entry is changed. As an

example, you may wish to implement the following method, or one like it:

baseView.DoReTargeting := func()

theFalseEntryView:Retarget()

There are several places in your code where this message could be sent. For
instance, if your application scrolls through entries, you should send the

DoReTargeting

message, defined above, to

ViewScrollUpScript

and

ViewScrollDownScript

. Following is an example of a

ViewScrollUpScript

method that scrolls through soup entries:

func()

begin

EntryChange(target);

cardSoupCursor:Prev();

:ResetTarget();

:DoRetargeting();

end

Other places where you may want to send the

Retarget

message include a

delete action method, a

ViewSetupDoneScript

method (which executes

immediately before a view is displayed or redisplayed), or even the

ButtonClickScript

method of a button that generates new entries and

thus changes the soup and its display.

Using a False Entry View

4

The example used here, in which the

newtFalseEntryView

is implemented, is

a non-NewtApp application that supports the use of slot views. If you want to adopt
slot views into an existing application, you must use

newtFalseEntryView

.

Once you have an application base view set up, you may add the following slots to
your

newtFalseEntryView

:

Add a

dataCursorSlot

and set it to the symbol

'cardSoupCursor

. This

symbol should match a slot defined in your application base view. The slot may
be omitted if your base application view’s cursor slot is set to the default name

dataCursor

.

Add a

dataSoupSlot

and set it to the symbol

'cardSoup

. This symbol

should match a slot defined in your application base view. The slot may be