Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 6 - Drawing and Graphics 2.1 / Using Drawing and Graphics in the Newton 2.1 OS


Creating Ink and TextBox Shapes

Two functions have been added to create ink and text box shapes: *MakeInk and *MakeTextBox. *MakeInk takes five parameters, an ink data object and four integer coordinates for the bounding box. *MakeTextBox also takes five parameters, a string and four integers for the bounding box.

The following code example illustrates the use of *MakeTextBox, producing the shape displayed in Figure 6-7:

local tb := MakeTextBox ("Note how text is automatically wrapped at word boundaries, and clipped at shape bounds.", 0, 0, 150, 123);

:DrawShape (tb,nil);

Figure 6-7 A textBox



The code example in Listing 6-2 illustrates the use of the *MakeInk function. This code sample is a method of a clEditView that creates a shape array with all the ink children of the view.

Listing 6-2 Function to retrieve ink shapes from a clEditView

myEditView.CollectInkShapes := func()

begin local kids := :ChildViewFrames(); local inkShapes := []; foreach child in kids do if child.ink then begin local bounds := child.viewBounds; AddArraySlot( inkShapes, MakeInk(child.ink,bounds.left,bounds.top, bounds.right, bounds.bottom)); end; inkShapes; end;


Previous Book Contents Book Index Next

© Apple Computer, Inc.
26 APR 1997



Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help