Selection
The RichEdit client API available using the selection property allows you to access and modify selections in a document.
The control keeps the following information about selection:
- the active sub document (activeSubDocument)
- the list of selected intervals (intervals)
- the start and end positions of the last selected interval (start, end, anchor, and active)
Example: in the image below, three intervals are selected. The last interval is selected from right to left. In this case, the properties return the following values.
#Set Selection
Selection API allows you to set a cursor position (selection with zero length), select a document interval, multiple intervals, or the entire sub-document. The table below lists methods that allow you to set selection.
Selected element | Method | Example |
---|---|---|
Set the cursor position | set |
rich ![]() |
Select an interval | set |
rich ![]() |
Select several intervals | set |
rich ![]() |
Select the entire sub-document | select |
rich ![]() |