<< Click to display table of contents >> TCustomRichView.GetLineNo |
Returns line of the position specified by ItemNo and ItemOffs.
function GetLineNo(ItemNo, ItemOffs: Integer): Integer;
(introduced in version 1.7)
Parameters
ItemNo – index of the item, in range from 0 to ItemCount-1.
ItemOffs – offset in item.
For non-text items, ItemOffs=0 specifies position before the item, ItemOffs=1 specifies position after the item (this is not important for this function, because non-text item cannot be placed on several lines).
For text items, ItemOffs specifies position before the ItemOffs-th character:
▪ItemOffs=1 – position before the text item (before the first character);
▪ItemOffs=2 – position before the second character;
▪ ....
▪ItemOffs=GetOffsAfterItem(ItemNo) – position after the last character of the text item.
Return value
Line index. The first line has index 1. Number of lines depends on word-wrapping.
Example:
with MyRichView do
r := GetLineNo(ItemCount-1, GetOffsAfterItem(ItemCount-1))
r receives number of lines in MyRichView.
Warning: this function contains calculations inside, and it may take a while to execute it. (There is an idea how to make it lightning-fast in future, but it will be implemented later).
This method must be called only when the document is formatted.
See also:
See also methods of TCustomRichViewEdit: