Apple Newton Utilities Guide de l'utilisateur Page 542

  • 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 541
CHAPTER 13
Drawing and Graphics
13-16 Using the Drawing Interface
viewFormat: nil,
ViewSetupFormScript: func()
begin
// aView is the view to be scaled
self.stepchildren := [aView];
end,
...};
Tran sl ating Data Shapes 13
You can use the global functions PointsToArray and ArrayToPoints to
translate points data between a polygon shape (
'polygonShape) and a
NewtonScript array.
Finding Points Within a Shape 13
Use the HitShape function to determine whether a pen event occurred within the
boundaries of the shape. This operation is useful for implementing button-like
behavior in any shape. Possible results returned by the HitShape function include:
nil // nothing hit
true // the primitive shape passed was hit
[2,5] // X marks the shape hit in the following array
// shape := [s,s,[s,s,s,s,s,X,s],s,s]
You can retrieve the shape by using the value returned by the HitShape method
as a path expression, as in the following code fragment:
result := HitShape(shape,x,y);
if result then // make sure non-nil
begin
if IsArray(result) then // its an array path
thingHit := shape.(result);
else
thingHit := shape;// its a simple shape
end
Although the expression shape.(result) may look unusual, it is perfectly
legitimate NewtonScript. For further explanation of this syntax, see the “Array
Accessor” discussion in
The NewtonScript Programming Language.
Vue de la page 541
1 2 ... 537 538 539 540 541 542 543 544 545 546 547 ... 941 942

Commentaires sur ces manuels

Pas de commentaire