Apple Newton Utilities Guide de l'utilisateur Page 330

  • 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 329
CHAPTER 8
Text and Ink Input and Display
8-38 Using Text
a view descended from protoInputLine with the vApplication ag set in
the
viewFlags slot
The Caret Pop-up Menu 8
Normally, when the user taps the insertion caret, the system-provided Punctuation
pop-up Menu opens. However, you can override this with a pop-up menu of your
own creation.
When the user taps the insertion caret, the system starts searching for a slot named
_caretPopup. The search begins in the view owning the caret, and follows both
the proto and parent inheritance paths. The default Punctuation pop-up is stored in
the root view.
The
_caretPopup slot must hold a frame containing two slots. The rst slot,
pop, defines a list of pop-up items suitable for passing to DoPopup. The second
slot must contain a
pickActionScript. If not, control passes to the punctuation
pop-up, which has its own version of the
pickActionScript. This routine then
inserts a string, corresponding to the selected character at the caret, by using the
function
PostKeyString.
Handling Input Events 8
You sometimes need to respond to input events that occur in text views. This
section describes how to test for a selection hit and respond to keystrokes and
insertion events.
Testing for a Selection Hit 8
After the user taps the screen, you can determine if the point “hits” a specic
character or word in a paragraph view.
The
view:PointToCharOffset method returns the offset within the paragraph
that is closest to the point (
x, y). This method is described in “PointToCharOffset”
(page 7-51) in Newton Programmers Reference.
The
view:PointToWord method returns a frame that indicates the position of
the word within the paragraph that is closest to the point (
x, y). This method is
described in “PointToWord” (page 7-52) in Newton Programmers Reference.
Note
Both of these functions return nil if the view is not a paragraph
view. Also, the point you are testing must correspond to a visible
position within the paragraph view; you cannot hit-test on
off-screen portions of a view.
Vue de la page 329
1 2 ... 325 326 327 328 329 330 331 332 333 334 335 ... 941 942

Commentaires sur ces manuels

Pas de commentaire