The IDLgrText::GetIndexRelativeTo function method returns the index of the character in the string closest to a given coordinate. See Character Indices in Text Strings for more information.

Syntax


Result = Obj->[IDLgrText::]GetIndexRelativeTo(Window, Index , Direction)

Return Value


An integer specifying the character index of the closest character above, below, or to either side of the index specified by Index.

Arguments


Window

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

Index

An integer specifying the character index of the character from which the search should begin.

Direction

An integer specifying the direction from Index. Possible values are:

  • 0: Left
  • 1: Right
  • 2: Up
  • 3: Down

Keywords


None.

Example


So the following call:

index=Obj->GetIndexRelativeTo(oWin, 11, 2)

returns 3, the closest insertion point above 11.

The following call:

index=Obj->GetIndexRelativeTo(oWin, 13, 3)

returns 19, the closest insertion point below 11.

Version History


7.0.6

Introduced