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

pointToParagraph()

Syntax

    sprite(whichSpriteNumber).pointToParagraph(pointToTranslate)
    pointToParagraph(sprite spriteNumber, pointToTranslate)

Description

Function; returns an integer representing the paragraph number located within the text or field sprite `spriteNumber` at screen coordinate `pointToTranslate`, or returns -1 if the point is not within the text. Paragraphs are separated by carriage returns in a block of text.

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

Example

This Lingo displays the number of the paragraph being clicked, as well as the text of the paragraph, in the Message window:

    property spriteNum

    on mouseDown me
    	pointClicked = the mouseLoc
    	currentMember = sprite(spriteNum).member
    	paragraphNum = sprite(spriteNum).pointToParagraph(pointClicked)
    	paragraphText = currentMember.paragraph[paragraphNum]
    	put "Clicked paragraph" && paragraphNum & ", the text" && paragraphText
    end

See also

`itemDelimiter`, `mouseLoc`, `pointToChar()`, `pointToWord()`, `pointToItem()`, `pointToLine()`