The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: none
Declaration: procedure TextLineCoords (const InString: string; const Pos: integer; var X, Y : integer);

The procedure TextLineCoords calculates the text coordinates (columns and rows) for a given string position, assuming that the ASCII character <LF> (ASCII 10) starts a new line of the text. The parameter InString contains the string to be analyzed, the parameter Pos is the index into the string for which the coordinates have to be calculated. The procedure returns the coordinates in the variable parameters X and Y (X is the column number, Y the line number).

Hint: Please note that the procedure has to count the line feed characters of the entire string up to the position Pos. Thus TextLineCoords is inherently slow if the string InString is long and Pos points to the end of the string.

Last Update: 2012-Oct-20