C H A P T E R 6
Pickers, Pop-up Views, and Overviews
You also need to define the following slot in your
This should be a cursor-like object.
You use the object stored in this slot to encapsulate your data. The cursor-like
object must support the methods
. An example is
In addition, you must provide a mechanism to find an actual data item given an
index of a displayed item. In general, you need some sort of saved index that
corresponds to the first displayed item. See the example code in "HitItem"
(page 5-88) in Newton Programmer's Reference for an example of how this is used.
You also should provide a mechanism to track the currently highlighted item,
which is distinct from a selected item.
Since your data is probably in an array, you can use a "cursor" object like this:
if index < Length(items) then
if index < Length(items)-1 then
index := index + 1;
index := Min(Max(index + delta, 0),
The methods that you need to have in the cursor-like object are:
, which returns the item pointed to by the "cursor."
, which moves the "cursor" to the next item and returns that item or, if
there is no next item,