This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.

# MousePosition

 gives the current mouse position in the notebook front end. MousePosition["coords"] gives the mouse position with respect to the specified coordinate system. MousePosition["coords", def] returns def if the mouse is not over an object that defines the specified coordinate system.
• Dynamic[MousePosition[]] gives the continually updated current mouse position.
• MousePosition[{"coords", h}] takes the coordinate system to extend only over the contents of the nearest enclosing object with head h.  »
• The following coordinate systems can be used:
 "ScreenAbsolute" absolute position within the complete screen display "ScreenScaled" scaled position within the complete screen display "WindowAbsolute" absolute position down the current window "WindowScaled" scaled position down the current window "DocumentAbsolute" absolute position down the current complete document "DocumentScaled" scaled position down the current complete document "CellAbsolute" absolute position within the current cell "CellScaled" scaled position within the current cell "CellContentsAbsolute" absolute position within the content area of the current cell "CellContentsScaled" scaled position within the content area of the current cell "EventHandlerAbsolute" absolute position within the current event handler region "EventHandlerScaled" scaled position within the current event handler region "Graphics" coordinates in the current graphic "Graphics3DBoxIntercepts" front and back intercepts with the 3D bounding box "GraphicsAbsolute" absolute position within the current graphic "GraphicsScaled" scaled position within the current graphic "GraphicsImageScaled" scaled position within the current graphics image area
• Absolute positions are given in printer's points, corresponding to pixels on 72 dpi displays.
• Scaled positions normally run from 0 to 1 in each direction.
• For constructs that appear within windows, position {0, 0} is taken to be at the bottom left.
• For complete windows and documents, {0, 0} is taken to be at the top left.
• For the complete screen display, {0, 0} is taken to be at the top-left corner of the primary monitor. Secondary monitors correspond to scaled positions outside the range 0 to 1.
• For "Graphics", ordinary coordinates as specified by PlotRange are used.
• MousePosition["coords"] is equivalent to MousePosition["coords", None], so that by default None is returned if the mouse is not over an object that defines the specified coordinate system.
Get the current position of the mouse:
Get the Dynamic position of the mouse:
Get the current position of the mouse:
 Out[1]=

Get the Dynamic position of the mouse:
 Out[1]=
 Scope   (4)
Get the mouse position in the coordinate system of the graphic:
Get the scaled coordinates of the mouse within the current window:
When the mouse is not within the specified coordinate system, return an expression:
Constrain the coordinate system of MousePosition:
 Applications   (1)
Change the color and opacity as the mouse is moved through the graphic:
MousePosition is often used with EventHandler:
New in 6