Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 2 - TextEdit / TextEdit Reference
Routines / Checking, Setting, and Replacing Styles


TEReplaceStyle

The TEReplaceStyle procedure replaces any character attributes in the current selection range that match the specified existing character attributes with the specified new character attributes.

PROCEDURE TEReplaceStyle (mode: INTEGER; 
                          oldStyle,newStyle: TextStyle;
                          redraw: BOOLEAN; hTE: TEHandle);
mode
A selector that specifies which attributes to replace. It corresponds to any additive combination of the mode constants for font, character style, type size, color, and so forth.
oldStyle
A pointer to a text style record that specifies the current character attributes to search for in the selected text.
newStyle
A pointer to a text style record that specifies the new attributes to be set. This record contains the character attributes to be applied to the current selection range based on the value of mode.
redraw
A flag that specifies whether or not TextEdit should immediately redraw the text to reflect the attribute changes. A value of FALSE delays redrawing until another event forces the update. A value of TRUE causes the text to be redrawn immediately using the new character attributes.
hTE
A handle to the multistyled edit record containing the text selection whose character attributes are to be changed.
DESCRIPTION
The TEReplaceStyle procedure replaces any attribute in the current selection range that matches the attribute specified by oldStyle with that given by newStyle. Only the character attributes specified by mode are affected.

Attribute changes are made directly to the style elements (STElement) within the style table itself (TEStyleTable). If you specify the value doAll for the mode parameter, newStyle replaces oldStyle outright. Possible values for the mode parameter are defined by the following constants. The TEReplaceStyle procedure has no effect on a monostyled edit record.
ConstantValueDescription
doFont1Sets the font family ID
doFace2Sets the character style
doSize4Sets the type size
doColor8Sets the color
doAll15Sets all attributes
addSize16Increases or decreases the current type size


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996