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 / Draw Application Reference
Proto / protoDrawTool


MakeObject

protoDrawTool:MakeObject(left, top, right, bottom, style)

Called to create a new graphic object when the user taps or drags in the canvas with the tool.

left
The x-coordinate of the start point of the rectangle the user dragged with this tool.

top
The y-coordinate of the start point of the rectangle the user dragged with this tool.

right
The x-coordinate of the end point of the rectangle the user dragged with this tool.

bottom
The y-coordinate of the start point of the rectangle the user dragged with this tool.

style
A style frame with the current user defaults for penSize, penPattern, fillPattern, and font.

return value
An array of shapes with the same class as the tool.

DISCUSSION

You must provide your own version of this method in your tool template.

The array returned should have a style frame at the front to make sure you get the drawing environment you want. The last two objects in the array should be an "invisible" style and a rectangle shape. The rectangle should be the size of the shape you are returning, and the style frame should be:

{penSize: 0, fillPattern: vfNone, selection: nil }

SPECIAL CONSIDERATIONS

If the user drags up and to the left, the values passed as the right and bottom arguments can be less than those passed as the left and top arguments. The left slot in your shape's bounds should be Min(left, right), the top slot should be Min(top, bottom), and so on.


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