Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 2 - Newton Works Draw Application / Using the Drawing Application Interface


The Canvas and Its Methods

The canvas view provides methods to programmatically add a shape to it, and a number of methods that manipulate the set of currently selected shapes. If you are writing code for a tool in the tool bar, simply send these methods to self. Otherwise, use the *GetCanvas method described in "Draw Application Methods".

The current drawing style is stored in the canvas' currentDrawStyle slot. You may change the values in this style frame programmatically; the user can also set some of these slot through the user interface.

The *AddShape method adds a new shape to the canvas. The canvas provides a *DirtyShape method to redraw the part of the canvas where the new shape was added. Simply pass the same shape to both functions, as in:

local shape := MakeRect (0,0,100,100);

:AddShape(shape,nil,nil); :DirtyShape(shape);

A number of functions exist to select shapes, and manipulate them. You can programmatically call many of the methods the user accesses though the Edit and Arrange pickers. See "The Canvas".


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