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


TESetStyle

The TESetStyle procedure sets new character attributes for the current selection range in the specified edit record.

PROCEDURE TESetStyle (mode: Integer; newStyle: TextStyle; 
                      redraw: Boolean; hTE: TEHandle);
mode
A selector that specifies which character attributes are to be changed. The value for mode can be any additive combination of the mode constants for font, style, type size, color, and so forth.
newStyle
A record of type TextStyle 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 affected text to reflect the new character attribute changes. A value of TRUE causes the text to be redrawn immediately. Line breaks, line heights, and line ascents are recalculated. A value of FALSE delays redrawing until another event forces the update.
hTE
A handle to the multistyled edit record containing the selected text.
DESCRIPTION
The TESetStyle procedure has no effect on a monostyled record. You can use any combination of the following constants to specify a value for the mode parameter. The value of mode specifies which existing character attributes are to be changed to the new character attributes specified by newStyle.
ConstantValueDescription
doFont1 Sets 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
doToggle32Modifies the mode

If doToggle is specified along with doFace and if an attribute specified in the given newStyle parameter exists across the entire selected range of text, then TESetStyle removes that attribute. Otherwise, if the attribute doesn't exist across the entire selection range, all of the selected text is set to include that character attribute.

If the redraw parameter is set to TRUE, TextEdit redraws the current selection range using the new character attributes, recalculating line breaks, line heights, and line ascents. If the redraw parameter is set to FALSE, TextEdit does not redraw the text or recalculate line breaks, line heights, and line ascents. Consequently, when you call a routine that uses any of this information, such as TEGetHeight (which returns a total height between two specified lines), it does not reflect the new character attributes set with TESetStyle. Instead, the routine uses the information that was available before TESetStyle was called. To update this information, call the TECalText procedure. (See "TECalText" on page 2-84 for more information.) To be certain that the new information is always reflected, call the TESetStyle procedure with the redraw parameter set to TRUE.

If you call the TESetStyle routine when the value of the selStart field of an edit record equals the value of the selEnd field (specifying an insertion point), TextEdit stores the input character attributes in the null scrap record pointed to by the null
style handle.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996