TCustomRichView.GetItemCoords, GetItemClientCoords

<< Click to display table of contents >>

TCustomRichView.GetItemCoords, GetItemClientCoords

The methods return coordinates of the item in RichView document.

function GetItemCoords(ItemNo: Integer;

  out Left,Top: Integer): Boolean;

function GetItemClientCoords(ItemNo: Integer;

  out Left,Top: Integer): Boolean;

(introduced in version 1.4)


Input parameter:

ItemNo index of the item. Items are indexed from 0 to ItemCount-1. Items of subdocuments (table cells) are not included in the items range of the main document.


Output parameters:

Left,Top coordinates of the top left corner of the item, pixels.

GetItemCoords returns document coordinates, i.e. (0,0) is in the top left corner of the scrollable area.

GetItemClientCoords returns client coordinates, i.e. (0,0) is in the top left corner of the control window.


These methods must be called only when the document is formatted.



the methods cannot be used to get coordinates of items inside table cells;

the methods return only the top left coordinates;

for text items occupying several lines, the methods return the coordinates for the first line;

for left- and right-aligned objects, the methods return the position of their placeholder in a text, not the position of a floating object.

GetItemCoordsEx does not have these limitations.


Return value:

True if coordinates were successfully retrieved (document must be formatted)


See also:

ClientToDocument, DocumentToClient.

See also methods of TCustomRVFormattedData