Help Center

CRichEditCtx.SetSelmethod

Selects a range of characters in a rich edit control.

Windowsmethoddocumented

Syntax

SUB SetSel OVERLOAD (BYVAL nStart AS LONG, BYVAL nEnd AS LONG)
SUB SetSel OVERLOAD (BYREF pt AS POINTL)

Parameters

NameDescription
nStartThe starting character position of the selection.
nEndThe ending character position of the selection.
ptA POINTL structure with its x and y members set to the starting and ending characters positions of the selection.

Description

Selects a range of characters in a rich edit control.

Remarks

The start value can be greater than the end value. The lower of the two values specifies the character position of the first character in the selection. The higher value specifies the position of the first character beyond the selection.

The start value is the anchor point of the selection, and the end value is the active end. If the user uses the SHIFT key to adjust the size of the selection, the active end can move but the anchor point remains the same.

If the start is 0 and the end is -1, all the text in the edit control is selected. If the start is -1, any current selection is deselected.

If the edit control has the ES_NOHIDESEL style, the selected text is highlighted regardless of whether the control has focus. Without the ES_NOHIDESEL style, the selected text is highlighted only when the edit control has the focus.

Reference

  • Defined in AfxNova/CRichEditCtx.inc:2222
  • Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
  • Topic: CRichEditCtx Class