Important: The information in this document is obsolete and should not be used for new development.
TEUseStyleScrap
TheTEUseStyleScrap
procedure assigns new character attributes to the specified range of text in the designated edit record.
PROCEDURE TEUseStyleScrap (rangeStart: LongInt; rangeEnd: LongInt; newStyles: STScrpHandle; redraw: Boolean; hTE: TEHandle);
rangeStart
- The offset of the first character in the text of the edit record to which the character attributes are to be applied.
rangeEnd
- The offset of the last character in the text of the edit record to which the character attributes are to be applied.
newStyles
- A handle to a style scrap record. The style scrap record contains the attributes to be applied to the specified range of text. If the value of
newStyles
isNIL
, no action is performed.redraw
- A flag that specifies whether TextEdit should immediately redraw the selection range using the new character attributes.
hTE
- A handle to the edit record containing the range of text to which the character attributes are to be applied. If the handle points to a monostyled edit record (created using
TENew
), no action is performed.DESCRIPTION
TheTEUseStyleScrap
procedure writes the character attribute information into the style record's style table and updates the style run table. If theredraw
parameter is set toTRUE
, the attributes are applied immediately to the specified range of text, and line breaks, line heights, and line ascents are recalculated. Ifredraw
is set toFALSE
, the new character attributes are not reflected in the view rectangle until the next update event occurs.Regardless of whether the text is redrawn, the current selection range is not changed; if characters are highlighted before
TEUseStyleScrap
is called, they remain highlighted after it is called. However, if characters within the current selection range also fall within the specified range of text, they are rendered in the new character attributes when the text is redrawn.Each element in the style scrap record contains a field that is the offset of the beginning of the element's character attributes. This field (
scrpStartChar
) defines the boundaries for the scrap's style runs.The
TEUseStyleScrap
procedure applies the first element's attributes to the characters fromrangeStart
up to thescrpStartChar
field of the next element. TheTEUseStyleScrap
procedure terminates without error if it prematurely reaches the end of the range or if there are not enough scrap style elements to cover the whole range. In the latter case,TEUseStyleScrap
applies the last set of character attributes in the style scrap record to the remainder of the range.Depending on the requirements of your application, you can create a style scrap record directly and pass its handle to
TEUseStyleScrap
as the value ofnewStyles
or you can use a style scrap record created byTEGetStyleScrapHandle
.