User Guide
491
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()
pointToWord()
Syntax
sprite(whichSpriteNumber).pointToWord(pointToTranslate)
pointToWord(sprite spriteNumber, pointToTranslate)
Description
Function; returns an integer representing the number of a word located within the text or field
sprite spriteNumber at screen coordinate pointToTranslate, or returns -1 if the point is not
within the text. Words are separated by spaces in a block of text.
This function can be used to determine the word under the cursor.
Example
This Lingo displays the number of the word being clicked, as well as the text of the word, in the
Message window:
property spriteNum
on mouseDown me
pointClicked = the mouseLoc
currentMember = sprite(spriteNum).member
wordNum = sprite(spriteNum).pointToWord(pointClicked)
wordText = currentMember.word[wordNum]
put "Clicked word" && wordNum & ", the text" && wordText
end
See also
itemDelimiter, mouseLoc, pointToChar(), pointToItem(), pointToLine(),
pointToParagraph()