Apple Newton Utilities Guide de l'utilisateur Page 191

  • 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 190
CHAPTER 5
Stationery
Using Stationery 5-9
The following example uses the constant kSuperSymbol as the value of the
superSymbol slot. It is defined as follows in the Extend Notes
Definition.f file:
constant kSuperSymbol := 'notes;// Note's SuperSymbol
Once you have created an NTK layout, named the template iouDataDef, and
saved the le under the name
iouDataDef, you may set the slots of the
iouDataDef as follows:
Set name to "IOU". This shows up in the New button’s picker.
Set superSymbol to the constant kSuperSymbol. This stationery can
only be used by an application that has a matching value in the
newtApplication base view’s superSymbol slot.
Set description to "An IOU entry". This string shows up in the
information box that appears when the user taps the icon on the left side of
the header, as shown in Figure 4-5 (page 4-9).
Set symbol to kDataSymbol.
Set version to 1. This is an arbitrary stationery version number set at your
discretion.
Remove the viewBounds slot; it’s not needed since this object is not a view.
There are a number of methods dened within the
newtStationery proto that
you should override for your data type.
Dening DataDef Methods 5
The three methods MakeNewEntry, StringExtract, and TextScript are
illustrated in this section. You use the method
MakeNewEntry to dene the soup
entries for your dataDef; the method
StringExtract is required by NewtApp
overview scripts to return text for display in the overview; and
TextScript is
called by the routing interface to return a text description of your data.
The
MakeNewEntry method returns a complete entry frame which will be added
to some (possibly unknown) application soup. You should use
MakeNewEntry,
instead of the
FillNewEntry method (which works in conjunction with the
NewtApp framework’s newtSoup.CreateBlankEntry), when your stationery
is being dened as an auto part.
The example of
MakeNewEntry used here denes the constant
kEntryTemplate as a frame in which to define all the generic parts of the entry.
All the specic parts of the data denition are kept in a nested frame that has the
name of the data class symbol, kDataSymbol. By keeping the specic denitions
of your data grouped in a single nested frame and accessible by the class of the
data, you are assuring that your code will be reusable in other applications.
Vue de la page 190
1 2 ... 186 187 188 189 190 191 192 193 194 195 196 ... 941 942

Commentaires sur ces manuels

Pas de commentaire