Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference » Functions

Note: This is a work in progress and will be formatting errors. 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

Placeholders

point
HyperTalk DefinitionAn 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 DefinitionAn expression that evaluates to a specific screen location, in the form of a list with two integer elements. For example:

{ 91, 303 }clickLoc

Related Topics

« mouseH and mouseV | HyperTalk Reference | number »


Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Modern View

Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » Functions

Note: This is a work in progress and will be formatting errors. 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

Placeholders

point
HyperTalk DefinitionAn 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 DefinitionAn expression that evaluates to a specific screen location, in the form of a list with two integer elements. For example:

{ 91, 303 }clickLoc

Related Topics

« mouseH and mouseV | HyperTalk Reference | number »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View