Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » mouseLoc

Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.

mouseLoc

the mouseLoc

Value returned: a point equal to the current position of the mouse pointer relative to the current card

Examples

get the mouseLoc
if it is within the rect of card button 1 then ...
set the loc of button 1 to mouseLoc()
if the mouseLoc is not within the rect of card window then beep

Demo Script

on mouseLocDemo
set the cursor to arrow
show bkgnd field "demo field"
put "Move the mouse to change the mouseLoc." & return & return &¬
"The mouseLoc is:" && the mouseLoc into bkgnd field "demo field"
put spaces(20) & "Click the mouse to stop . . ." into ¬
line 5 of bkgnd field "demo field"
repeat until the mouseClick
put the mouseLoc into last word of line 3 of ¬
bkgnd field "demo field"
end repeat
hide bkgnd field "demo field"
put empty into bkgnd field "demo field"
end mouseLocDemo

Related Topics

Placeholders

point

HyperTalk Definition

An expression that evaluates to a specific screen location, in the form of two integers separated by a comma.

Item 1 of a point is the horizontal offset (in pixels). Item 2 of a point is the vertical offset (in pixels). For example:

91,303
"91,303"
"30" & "," & "100"
the clickLoc

AppleScript Definition

An expression that evaluates to a specific screen location, in the form of a list with two integer elements. For example:

{ 91, 303 }
clickLoc

HyperTalk Reference

Version 0.8b4 (July 4, 2025)

Made with Macintosh

Switch to Retro View