Range

From Xojo Documentation

Revision as of 18:56, 19 November 2009 by WikiSysop (talk) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Description

Used to get the starting position, length, and end position of a StyleRun.


Super Class

Object

Properties

Name Type Description
EndPos
Integer The ending position of the StyleRun.
Length Integer The length of the StyleRun.
StartPos Integer The starting position of the StyleRun. The first position is zero.


Notes

A StyleRun is a series of characters with the same style attributes in a StyledText object. A block of StyledText can be thought of as a group of StyleRuns that are appended to each other. Use the Range class to access the position of a StyleRun within the styled text.


Examples

The following example loops through the StyleRuns in a block of StyledText that is displayed in a TextArea. It uses the StartPos and Length properties of the Range class to get the position of each StyleRun and displays it and the text of each StyleRun in a ListBox.

Dim count, i as Integer
count=TextArea1.StyledText.StyleRunCount //get the number of StyleRuns
For i=0 to count-1 //loop through them
ListBox1.Addrow Str(TextArea1.StyledText.StyleRunRange(i).StartPos)
ListBox1.Cell(i,1)=Str(TextArea1.StyledText.StyleRunRange(i).Length)
ListBox1.Cell(i,2)=TextArea1.StyledText.StyleRun(i).Text
Next


See Also

Paragraph, StyledTextStyleRun classes; TextArea control.