TextEdit.InsertionPosition

From Xojo Documentation

Revision as of 22:04, 29 January 2020 by PLefebvre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Method

TextEdit.InsertionPosition(X as Integer, Y as Integer) As Integer

New in 2019r2

Supported for all project types and targets.

Returns (as an Integer) returns the position of the insertion point closest to pixel coordinates X,Y relative to the control. The returned value is zero-based.

Example

This example is in the MouseDown event of a TextArea. This event passes in the X,Y coordinates of the MouseDown event and the method returns the corresponding character position.

Var i As Integer
i = TextArea1.InsertionPosition(x, y)
MessageBox(i.ToString)
Return True