beautypg.com

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

Page 229

background image

C H A P T E R 6

Pickers, Pop-up Views, and Overviews

Overview Protos

6-29

The picker definition (described in the next section) is a data definition frame that
is provides the routines to create a name reference from an entry, an entry alias,
another name reference, a straight frame, or just to create a canonical empty name
reference (if no data is provided). It also retrieves the data from a name reference.
Finally, it provides some information about the name reference to support actions
like tapping and highlighting.

You also need to define the soup to query. Both this and the query specification can
be defined either in the data definition or in the list picker.

Using the Data Definitions Frame in a List Picker

6

The

pickerDef

slot of the list picker holds a data definition frame that determines

the overall behavior of the list picker. This frame should be based on

protoNameRefDataDef

or

protoPeopleDataDef

, or at should least support

the required slots.

Here is an example:

pickerDef:= {

_proto:

protoNameRefDataDef,

name:

"Widgets",

class:

'|nameRef.widget|,

entryType:

'widget,

soupToQuery:"Widgets",

querySpec:

{indexPath: 'name},

columns:

kColumns,

};

Specifying Columns

6

The

columns

slot hold an array that determines how the columns in the list picker

are displayed. Here’s an example of column specification array:

columns:= [{

fieldPath:'name,// path for field to display in column

optional:true,// not required -- unnamed widget

tapWidth:155},// width for checkbox & name combined

{

fieldPath:'price,// path for field to display

in column

optional:nil,// price is required

tapWidth:0}];// width -- to right end of view