Lingo Dictionary > L-N > mouseWord

 

mouseWord

Syntax

the mouseWord

Description

System property; contains the number of the word under the pointer when the property is called and when the pointer is over a field sprite. Counting starts from the beginning of the field. When the mouse is not over a field, the result is -1.

The value of the mouseWord property can change in a handler or repeat loop. If a handler or repeat loop uses this property multiple times, it's usually a good idea to call the function once and assign its value to a local variable.

Example

This statement determines whether the pointer is over a field sprite and changes the content of the field cast member Instructions to "Please point to a word." when it is not:

if the mouseWord = -1 then
	member("Instructions").text = "Please point to a word." 
else
	member("Instructions").text = "Thank you."
end if

Example

This statement assigns the number of the word under the pointer in the specified field to the variable currentWord:

currentWord = member(the mouseMember).word[the mouseWord]

Example

This handler highlights the word under the pointer when the mouse button is pressed:

on mouseDown
	thisField = sprite(the clickOn).member
	if the mouseWord < 1 then exit
	lastWord = 0
	repeat while the stillDown
		MW = the mouseWord
		if MW < 1 then next repeat
		if MW <> lastWord then
			thisField.word[MW].hilite()
				lastWord = MW
		end if
	end repeat
end

See also

mouseChar, mouseItem, mouseLine, number (words), word...of