IDLgrText::GetIndexAtCoord

The IDLgrText::GetIndexAtCoord function method returns the index of the character in the string closest to a specified screen coordinate.

Tip: In the context of this method, screen coordinates are normalized coordinates defined by the bounding box of the text object.

Syntax

Result = Obj->[IDLgrText::]GetIndexAtCoord(Window,X, Y)

Return Value

An integer specifying the character index of the character closest to the position specified by X and Y.

Arguments

Window

An object reference to the IDLgrWindow object in which the text appears.

X

A floating-point value between 0.0 and 1.0 specifying the horizontal coordinates relative to the bounding box of the text object.

Y

A floating-point value between 0.0 and 1.0 specifying the vertical coordinates relative to the bounding box of the text object.

Keywords

None

Example

The bounding box of the IDLgrText object is defined as shown below. The coordinates are the same regardless of the size of the text box. So the following call:

index=Obj->GetIndexAtCoord(oWin, 0.22, 0.77)

returns 2, which is the index of the closest insertion point.

See Character Indices in Text Strings for more information.

Version History

7.0.6

Introduced