background image
C H A P T E R 7
Controls and Other Protos
Scroller Protos
, and
. Each of these slots is a bounds frame with the
following form:
{left: 0, top: 0, right: 10, bottom: 10}
You usually create these bounds frame slots with the utility function
which is described in "SetBounds" (page 2-34) in Newton Programmer's Reference.
When you use these slots, the scroller protos highlight the scrolling arrows
automatically to indicate to the user that more data can be viewed by tapping on the
highlighted arrows.
Each of the bounds frame slots serves a specific purpose in the scroller, as shown in
Table 7-1. The next section provides several examples of setting the values of these
slots for different scrolling effects.
Scrolling Examples
This section presents several simple examples of setting the bounds frame slots in
your scroller to allow scrolling.
Scrolling Lines of Text
To scroll lines of text, you set the values of the three scroller bounds frames as
required for your application. For example, if you have 20 text items in a vertical
list and you want to show 6 of the items at a time, you need to set the slot values
as follows:
scrollRect: SetBounds(0, 0, 0, 20)
// 20 possible lines
SetBounds(0, 0, 0, 6)
// show 6 at a time
SetBounds(0, 0, 0, 20)
Table 7-1
Scroller bounds frame slots
Slot name
Specifies the scrollable area, which is the total area that the
user can see, or scroll over, with the scroller.
Specifies the part of the scrollable area that the user can
see at any one time. This is usually smaller than the area
specified by
Specifies the portion of the
that contains
data. In simple cases, this is the same as
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна