Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 3 - Word Processing Views / Word Processing View Reference
Protos / protoTXView


Replace

protoTXView:Replace(range, data, undoable)

Replaces the data inside of the specified range with the specified data. You can replace text and/or graphics with this method.

range
A range frame defining the text range that you want to change. See "The Range Frame".

data
A frame describing the new data. This can be a graphics specification frame, as described in "The Graphics Specification Frame". Or data can be a frame with the following slots:

text If this slot is nil, style runs are replaced, but the text remains the same. If non-nil, this is the new text string.

styles If this slot is nil, the new text uses the style attributes at the start of the range. If non-nil, this is an array with two entries for each style run in the range. The first entry specifies the number of characters, and the second is either a font specification frame or a graphics specification frame. The run length is always 1 for graphics specification objects. For a description of the font specification frame, see the section "Font Frame" (8-18) in Newton Programmer's Guide. See "The Graphics Specification Frame" for a description of the graphics specification frame.

undoable
If non-nil, the operation is undoable.

return value
An error code, or nil if the operation worked.

EXAMPLE

The following call to the *Replace method changes the first ten characters to the word "any" using the system font, bold face, point size 9:

myTxView:Replace( {first:0, last:10},

{text:"any", styles: [3, tsSystem+tsSize(10)+tsBold]} );

The following call to the *Replace method changes the first ten characters of the range to a rounded rectangle:

myShape:= makeroundrect(0, 0, 50, 50, 16);

myTxView:Replace({first:0, last:10}, {class: 'graphics, shape: myShape})


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