User Guide
490
pointToItem()
Syntax
sprite(whichSpriteNumber).pointToItem(pointToTranslate)
pointToItem(sprite spriteNumber, pointToTranslate)
Description
Function; returns an integer representing the item position in the text or field sprite
spriteNumber at screen coordinate pointToTranslate, or returns -1 if the point is not within
the text. Items are separated by the
itemDelimiter property, which is set to a comma by default.
This function can be used to determine the item under the cursor.
Example
This Lingo displays the number of the item being clicked, as well as the text of the item, in the
Message window:
property spriteNum
on mouseDown me
pointClicked = the mouseLoc
currentMember = sprite(spriteNum).member
itemNum = sprite(spriteNum).pointToItem(pointClicked)
itemText = currentMember.item[itemNum]
put "Clicked item" && itemNum & ", the text" && itemText
end
See also
itemDelimiter, mouseLoc, pointToChar(), pointToWord(), pointToItem(),
pointToLine(), pointToParagraph()
pointToLine()
Syntax
sprite(whichSpriteNumber).pointToLine(pointToTranslate)
pointToLine(sprite spriteNumber, pointToTranslate)
Description
Function; returns an integer representing the line position in the text or field sprite
spriteNumber at screen coordinate pointToTranslate, or returns -1 if the point is not within
the text. Lines are separated by carriage returns in the text or field cast member.
This function can be used to determine the line under the cursor.
Example
This Lingo displays the number of the line being clicked, as well as the text of the line, in the
Message window:
property spriteNum
on mouseDown me
pointClicked = the mouseLoc
currentMember = sprite(spriteNum).member
lineNum = sprite(spriteNum).pointToLine(pointClicked)
lineText = currentMember.line[lineNum]
put "Clicked line" && lineNum & ", the text" && lineText
end
See also
itemDelimiter, mouseLoc, pointToChar(), pointToWord(), pointToItem(),
pointToLine(), pointToParagraph()