beautypg.com

Using protosoupoverview 6 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 233

background image

C H A P T E R 6

Pickers, Pop-up Views, and Overviews

Overview Protos

6-33

Changing the Font of protoListPicker

6

The mechanism described here will probably change in the future. Eventually you
may be able to set a

viewFont

slot in the list picker itself, just as you can set

viewLineSpacing

now. In the meantime, you need a piece of workaround code.

You must set the

viewFont

of the list picker and also include this workaround

code.

Give the list picker the following

viewSetupDoneScript

:

func()

begin

if listBase then

SetValue(listBase, 'viewFont, viewFont) ;

inherited:?viewSetupDoneScript();

end;

This sets the

viewFont

of the

listbase

view to the view font of the list picker.

You cannot rely on the

listbase

view always being there (hence the test).

Using protoSoupOverview

6

For the most part, you use this proto like

protoOverview

, except that it is set up

to use a soup cursor, and, so, is easier to use. See “Using protoOverview” (page 6-24)
for information.

Determining Which protoSoupOverview Item Is Hit

6

There is a method of

protoSoupOverview

called

HitItem

that is called

whenever an item is tapped. The method is defined by the overview and you should
call the inherited method. Also note that

HitItem

gets called regardless of where

in the line a tap occurs. If the tap occurs in the checkbox (that is, if

x

is less than

selectIndent

), you should do nothing other than calling the inherited functions,

because the inherited function will handle the tap, otherwise you should do
something appropriate.

The method is passed the index of the item that is hit. The index is relative to the
item displayed at the top of the displayed list. This item is always the current entry
of the cursor used by

protoSoupOverview

, so you can find the actual soup entry

by cloning the cursor and moving it.

func(itemIndex, x, y)

begin

// MUST call the inherited method for bookkeeping

inherited:HitItem(itemIndex, x, y);