Apple Newton Utilities Guia do Utilizador Página 225

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 942
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 224
CHAPTER 6
Pickers, Pop-up Views, and Overviews
Overview Protos 6-25
You also need to dene the following slot in your protoOverview:
cursor 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
Entry, Next, Move, and Clone. An example is
given below.
In addition, you must provide a mechanism to nd an actual data item given an
index of a displayed item. In general, you need some sort of saved index that
corresponds to the rst displayed item. See the example code in “HitItem”
(page 5-88) in Newton Programmers 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:
{ items: nil,
index: 0,
Entry:func()
begin
if index < Length(items) then
items[index];
end,
Next: func()
if index < Length(items)-1 then
begin
index := index + 1;
items[index];
end,
Move: func(delta)
begin
index := Min(Max(index + delta, 0),
kNumItems-1) ;
items[index];
end,
Clone:func()
Clone(self)}
The methods that you need to have in the cursor-like object are:
Entry, which returns the item pointed to by the “cursor.
Next, which moves the “cursor” to the next item and returns that item or, if
there is no next item,
nil.
Vista de página 224
1 2 ... 220 221 222 223 224 225 226 227 228 229 230 ... 941 942

Comentários a estes Manuais

Sem comentários