Lingo Dictionary > L-N > mouseLine |  |

mouseLine

Syntax

    the mouseLine

Description

System property; contains the number of the line under the pointer when the property is called and the cursor is over a field sprite. Counting starts at the beginning of the field; a line is defined by Return delimiter, not by the wrapping at the edge of the field. When the mouse is not over a field sprite, the result is -1.

The value of the `mouseLine` 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 property once and assign its value to a local variable.

Example

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

    if the mouseLine = -1 then
    	member("Instructions").text = "Please point to a line."

Example

This statement assigns the contents of the line under the cursor in the specified field to the variable `currentLine`:

    currentLine = member(the mouseMember).line[the mouseLine]

Example

This handler highlights the line under the cursor when the mouse button is pressed:

    on mouseDown
    	thisField = sprite(the clickOn).member
    	if the mouseLine < 1 then exit
    	lastLine = 0
    	repeat while the stillDown
    		ML = the mouseLine
    		if ML < 1 then next repeat
    		if ML <> lastLine then
    			thisField.line[ML].hilite()
    			lastLine = ML
    		end if
    	end repeat
    end

See also

`mouseChar`, `mouseItem`, `mouseWord`, `line...of`, `number (lines)`