Lingo Dictionary > O-R > pointToChar() |  |

pointToChar()

Syntax

`pointToChar(sprite` `spriteNumber``,` `pointToTranslate``)`

Description

Function; returns an integer representing the character position located within the text or field sprite `spriteNumber` at screen coordinate `pointToTranslate`, or returns -1 if the point is not within the text.

This function can be used to determine the character under the cursor.

Example

This Lingo displays the number of the character being clicked, as well as the letter, in the Message window:

    property spriteNum

    on mouseDown me
    	pointClicked = the mouseLoc
    	currentMember = sprite(spriteNum).member
    	charNum = sprite(spriteNum).pointToChar(pointClicked)
    	actualChar = currentMember.char[charNum]
    	put "Clicked character" && charNum & ", the letter" && actualChar
    end

See also

`mouseLoc`, `pointToWord()`, `pointToItem()`, `pointToLine()`, `pointToParagraph()`