beautypg.com

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

Page 234

background image

C H A P T E R 6

Pickers, Pop-up Views, and Overviews

6-34

Overview Protos

if x > selectIndent then

begin

// get a temporary cursor based on the cursor used

// by soup overview

local tCursor := cursor:Clone();

// move it to the selected item

tCursor:Move(itemIndex) ;

// move the application’s detail cursor to the

// selected entry

myBaseApp.detailCursor:Goto(tCursor:Entry());

// usually you will close the overview and switch to

// some other view

self:Close();

end;

// otherwise, just let them check/uncheck

// which is the default behavior

end

Displaying the protoSoupOverview Vertical Divider

6

The mechanism for bringing up the vertical divider line was not correctly
implemented in

protoSoupOverview

. You can draw one in as follows:

// set up a cached shape for efficiency

mySoupOverview.cachedLine := nil;

mySoupOverview.viewSetupDoneScript := func()

begin

inherited:?viewSetupDoneScript();

local bounds := :LocalBox();

cachedLine := MakeRect(selectIndent - 2, 0,

selectIndent - 1, bounds.bottom);

end;

mySoupOverview.viewDrawScript := func()

begin

// MUST call inherited script

inherited:?viewDrawScript();

:DrawShape(cachedLine,

{penPattern: vfNone, fillPattern: vfGray});

end;