TextView.getIterAtPosition

Retrieves the iterator pointing to the character at buffer coordinates x and y. Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with TextView.windowToBufferCoords.

Note that this is different from TextView.getIterAtLocation, which returns cursor locations, i.e. positions between characters.

class TextView
bool
getIterAtPosition
(,
out int trailing
,
int x
,
int y
)

Parameters

iter TextIter
trailing int

if non-NULL, location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the trailing edge of the grapheme.

x int

x position, in buffer coordinates

y int

y position, in buffer coordinates

Return Value

Type: bool

TRUE if the position is over text

Meta