background image
C H A P T E R 4
NewtApp Applications
4-10
About the NewtApp Framework
data which they format appropriately. For example, the number views
(
newtNumberView
and
newtRONumberView
) format number data (according to
the value of a
format
slot you set).
The labelled input-line slot view protos provide you with a label, which you may
specify, for the input line. Additionally, the label may include a picker (pop-up menu).
These views also format a particular kind of data. To do this they use a special
NewtApp object known as a filter to specify a value for the
flavor
slot of the
labelled input-line slot views.
The filter object essentially acts as a translator between the target data frame (or
more typically, a slot in that frame) and the text field visible to the user. For
example, in the
newtDateInputLine
proto, a filter translates the time from a
time-in-minutes value to a string, which is displayed. The filter then translates the
string back to a time-in-minutes value, which is saved in the soup.
You can create custom filters by basing them on the proto
newtFilter
or on the
other filters documented in Table 3-1 (page 3-60) in the Newton Programmer's
Reference
. You can also create custom labelled input-line slot views. See the example
in "Creating a Custom Labelled Input-Line Slot View," beginning on page 4-24.
You can have your label input-line protos remember a list of recent items. To do so,
all you need do is assign a symbol to the
'memory
slot of your template. This
symbol must incorporate your developer signature. The system automatically
maintains the list of recent items for your input line. To use the list, you need to
use the same symbol with the
AddMemoryItem
,
AddMemoryItemUnique
,
GetMemoryItems
, and
GetMemorySlot
functions, which are described in
Chapter 26, "Utility Functions."
In addition, one special slot view, called the
newtSmartNameView
proto, allows
the user to choose a name from the soup belonging to the built-in Names application.
It adds the pop-up menu item, Other, to the picker; when the user chooses Other
from the
newtSmartNameView
proto, it displays the names in the Names
application soup in a system-provided people picker.
After you choose a name and close the view displaying the Names soup, that
name is displayed on the input line. The name is also put into the Picker menu.
A
newtSmartNameView
proto is shown in Figure 4-6.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна