
these slot views include a label and can pop-up lists of potential values. The
miscellaneous slot views include the
newtEditView
and the
newtCheckBox
.
Slot views are implemented for many types of common data. Text,
integers, real numbers, symbols, and entire notes can be displayed and
edited by using the appropriate slot views. The names of the slot view
protos, while typically long and sometimes cumbersome, are good cues to
indicate where to use each one. For instance, it’s easier to know when to
use a
newtLabelPhoneInputLine
than to type it. In addition to the
data type being in the name, if the proto name contains the letters “
RO
” (as
in
newtRONumberView
), this tells you that the proto is read-only and
can be used only to display data.
Despite their varying formats and capabilities, all slot views have a
common interface. All slot views use a path slot, which contains the path
reference to that slot view’s corresponding slot in the soup entry. This path
reference can be a simple symbol, like
‘myDataSlot
, or a path expression,
like
[pathExpr: ‘myClassFrame, ‘myDataSlot]
. They all
implement the
ReTarget
method, which forces a slot view to update its
view’s value from the value in the specified path. When any of the slot views
change, they all trigger the flush timer in the entry level. Most slot views
also implement a
JamFromEntry
method which is controlled by the
jamSlot
.
JAMMING
Jamming is the technique used by the slot views to incorporate data from
other soups’ entries in their own entry. Certain label-style slot views can
query another soup for the contents of their popup, or display a picker of
soup entries for the user to choose from. The most useful of these is
newtSmartNameView
. To use data from the built-in names soup in
your application, simply provide a
newtSmartNameView
. When the
user taps this slot view, the standard Names list picker appears. When the
user chooses a name from the picker, the current entry view in your
application is “jammed” with the chosen names entry. The
JamFromEntry(otherEntry)
method in each of your slot views is then
called.
JamFromEntry
checks to see if you’ve set the
jamSlot
for that
view. If
jamSlot
is not nil, it is used as a path expression in the foreign
entry. The contents of the slot view’s path are then replaced by the
contents of the foreign entry’s
jamSlot
. For example, if I wanted to
include the name and title of a customer in my application’s entry, I would
use a
newtSmartNameView
with a path of
‘customerName
. In
Newton Technology Journal June 1996
17
NTJ
If you have an idea
for an article
you’d like to write
for Newton Technology Journal,
send it via Internet to:
or AppleLink: NEWTONDEV
To request information on
or an application for
Apple’s Newton developer programs,
contact Apple’s Developer Support Center at
408-974-4897
or Applelink: NEWTONDEV
Comentarios a estos manuales