Apple Newton Utilities Guide de l'utilisateur Page 230

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 942
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 229
CHAPTER 6
Pickers, Pop-up Views, and Overviews
6-30 Overview Protos
See “Column Specications” (page 5-3) in Newton Programmers Reference for
details of the slots.
Having a Single Selection in a List Picker 6
The key to getting single selection is that single selection is part of the picker
denition and not an option of
protoListPicker. That means the particular
class of
nameRef you use must include single selection. In general, this requires
creating your own subclass of the particular name reference class.
The basic solution is to create a data denition that is a subclass of the particular
class your
protoListPicker variant will view. That data denition will include
the
singleSelect slot. As an example, suppose you want to use a
protoPeoplePopup that just picks individual people. You could use the
following code to bring up a
protoPeoplePopup that allows selecting only one
individual at a time:
// register the modified data definition
RegDataDef('|nameref.people.single:SIG|,
{_proto: GetDataDefs('|nameRef.people|), singleSelect:
true});
// then pop the thing
protoPeoplePopup:New('|nameref.people.single:SIG|,[],self,[
]);
// sometime later
UnRegDataDef('|nameref.people.single:SIG|);
For other types of protoListPickers and classes, create the appropriate
subclass. For example, a transport that uses
protoAddressPicker for e-mail
messages might create a subclass of
'|nameRef.email| and put that subclass
symbol in the class slot of the
protoAddressPicker.
Since many applications are likely to do this, you may cut down on code in your
installScript and removeScript by registering your dataDef only for the
duration of the picker. That would mean registering the class just before you pop
the picker and unregistering after the picker has closed. You can use the
pickActionScript and pickCanceledScript methods to be notified when
to unregister the
dataDef.
Having Preselected Items in a List Picker 6
If you want to have items that are initially selected in a list picker, use the
viewSetupDoneScript to set up the selected array, rather than setting up
the selected array in your
viewSetupFormScript or
viewSetupChildrenScript, then send the Update message to
protoListPicker to tell it to update the display.
Vue de la page 229
1 2 ... 225 226 227 228 229 230 231 232 233 234 235 ... 941 942

Commentaires sur ces manuels

Pas de commentaire