StyledText.StyleRunRange
From Xojo Documentation
Method
Returns a Range for the specified StyleRun. Index is zero-based.
Notes
Properties of the Range class give you access to the StyleRun’s starting and ending positions, and length.
Example
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.
Var count As Integer
count = TextArea1.StyledText.StyleRunCount // get the number of StyleRuns
For i As Integer = 0 To count - 1 // loop through them
ListBox1.AddRow(TextArea1.StyledText.StyleRunRange(i).StartPos.ToString)
ListBox1.CellValueAt(i, 1) = TextArea1.StyledText.StyleRunRange(i).Length.ToString
ListBox1.CellValueAt(i, 2) = TextArea1.StyledText.StyleRun(i).Text
Next
count = TextArea1.StyledText.StyleRunCount // get the number of StyleRuns
For i As Integer = 0 To count - 1 // loop through them
ListBox1.AddRow(TextArea1.StyledText.StyleRunRange(i).StartPos.ToString)
ListBox1.CellValueAt(i, 1) = TextArea1.StyledText.StyleRunRange(i).Length.ToString
ListBox1.CellValueAt(i, 2) = TextArea1.StyledText.StyleRun(i).Text
Next