beautypg.com

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

Page 392

background image

C H A P T E R 1 0

Recognition: Advanced Topics

10-16

Using Advanced Topics in Recognition

// indent from left of view to first letter

constant kBoxIndent := 4;

// width of a single box in the grid

constant kCellWidth := 24;

// create editable recConfig frame and set initial values

myView.ViewSetupDoneScript := func()

begin

// prebuild RAM copy that we can change

recConfig := PrepRecConfig(recConfig);

// set these same flags in myView.viewFlags

recConfig.inputMask :=

vClickable+vGesturesAllowed+vCustomDictionaries;

// get global bounds of enclosing view

local box := :GlobalBox();

// calc left edge of boxes in grid

local leftX := box.left + kBoxIndent;

// specify baseline and expected letter height

recConfig.rcBaseInfo :=

{

// baseline for writing

base: box.top + viewLineSpacing,

// height of a small letter

smallHeight: kSmallHeight,

};

// specify horizontal info for an array of boxes

recConfig.rcGridInfo :=

{

// left edge of first box

boxLeft: leftX,

// right edge of first box

boxRight: leftX + kCellWidth,

// width to left edge of next box

xSpace: kCellWidth,

};

// use new settings

PurgeAreaCache();

end;