Function MPostoLc() Foundation

Determines the row and column position from a character position.

Syntax
MPostoLc( <cString>  , ;
          <nLineLen> , ;
          <nPosition>, ;
         [<nTabSize>], ;
         [<lWrap>]     ) --> aRowCol
Parameters
<cString>
<cString> is a character string which may contain formatting characters like tab (Chr(9)) and return (Chr(13)+Chr(10)).
<nLineLen>
<nLineLen> is an integer numeric value which indicates the maximum length of a line in <cString>.
<nPosition>
<nPosition> designates the exact position of a character within <cString>. The position counter begins with one.
<nTabSize>
<nTabSize> specifies the tab size. The default value is four characters per tab. The maximum value for the tab spacing is <nLineLen> - 1.
<lWrap>
The logical value <lWrap> indicates whether consideration for word wrapping is done. The default value is .T. (true) which specifies that word wrapping is considered. When the value .F. (false) is specified, word wrapping is not considered.
Return

The return value of MPostoLc() is an array containing two elements whose values indicate the row and column position ({nRow,nCol}) corresponding to the character at the specified position <nPosition>.

Description

The memo function MPostoLc() calculates the row and column position of a character from its absolute position within <cString>. It is the counterpart of the function MlCtoPos(). The row and column positions are returned in an array ({nRow,nCol}). The counter for the row begins with one, and the counter for the column begins with zero. The absolute position <nPosition> also begins with one and can be determined using other character functions like SubStr() or At().

The function MPostoLc() is often used with MlCtoPos(). They might be used to program text search routines for MemoEdit(), for example.

Examples
MPostoLc()
// An extensive MemoEdit() routine with a search function is 
// shown as an example for the function MlCtoPos(). It uses 
// both MPostoLc() and MlCtoPos(). See function MlCtoPos() 
// or the example "Search routine for MemoEdit()" in the 
// online help. 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.