RichEdit::LineFromChar

Description

Get line number from character index

Syntax

long LineFromChar( long nIndex = -1 )const

Parameters

nIndex
the zero-based index value for the desired character
in the text of the edit control, or contains -1.
If nIndex is -1, it specifies the current line, that is,
the line that contains the caret.

Return

The zero-based line number of the line containing the character

index specified by nIndex. If nIndex is -1, the number of the

line that contains the first character of the selection is returned.

If there is no selection, the current line number is returned.

Examples

EX1

#include <..\OriginLab\DialogEx.h>
#define IDC_RICHEDIT1 1001

void RichEdit_LineFromChar(Dialog& EditBoxes)
{
        RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
        // The index of the char to get information on.
        int nIndex = 10;
        long nLine = richEdit.LineFromChar(nIndex);
}

Remark

See Also

header to Include

Control.h