Skip to content

FirstCharInLinePos - DfBaseRichEdit

Returns position of first character in a line

Type: Function
Return Data Type: integer

Parameters

Parameter Type Description
iLine integer Number of line (zero-based)

Syntax

Function FirstCharInLinePos integer iLine Returns integer

Call Example

Get FirstCharInLinePos iLine to integerVariable

Description

Returns zero-based position of first character in line number iLine from control.

The character position is the zero-based absolute position of the character in the control. The first position in the first line is always 0. If the first line in the control contains 20 characters, the first position in the second line will be 20.

If iLine is -1, returns the position of the first character in the current line. If text is selected, returns position of the first character in the line of the beginning of the selected text.

If iLine is greater than total number of lines in control, function returns -1.

This method has no effect if control is not paged.

Sample

This sample gets the position of the first character in the current line in control oRichEdit1 to variable iFirstCharPos and then displays it to the user in a message box.

Procedure GetFirstCharInCurrentLine
    integer iFirstCharPos iLineNum

    // indicates that we want the current line
    move -1 to iLineNum

    get FirstCharInLinePos of oRichEdit1 iLineNum to iFirstCharPos

    send Info_Box ("Position " + string(iFirstCharPos))
End_Procedure // GetFirstCharInCurrentLine

Return Value

Zero-based position of first character in line number iLine.