This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

CurrentValue

CurrentValue[item]
gives the current value of item at a location in the Mathematica system and interface.
CurrentValue
gives the current value for the feature of item specified by spec.
CurrentValue
gives the current value of item associated with the object obj.
  • CurrentValue by default refers to the location at which it appears in a notebook structure.
  • CurrentValue is most often used inside Dynamic, where it by default refers to the dynamic object being displayed.
  • Values for appropriate items can be reset using CurrentValue[item]=val, or implicitly through Dynamic.
  • For any option in the notebook front end, the current value at a particular location can be accessed using CurrentValue[opt].
  • For options whose settings are lists of the form , CurrentValue picks out the current value of .
  • CurrentValue[{StyleDefinitions, "style"}] gives the explicit style definitions that would be used for the style with name style at the current location.
  • Possible special items that can be used in CurrentValue include:
"MouseOver"True if the mouse is over the location
"SelectionData"the contents of the selection in this notebook
"SelectionOver"True if the selection includes the current location
  • The following refer to the mouse:
"MouseButtons"a list of mouse buttons currently pressed
"MouseButtonTest"True if the main mouse button is currently pressed
{"MouseButtonTest",i}True if mouse button i is currently pressed
"MouseClickCount"number of mouse clicks for the triggering event
"MouseOver"True if the mouse is over the current location
"MousePosition"the current position of the mouse
{"MousePosition",coords}the mouse position in the specified coordinate system
  • The primary mouse button is represented as . The secondary ("right") button is . The scroll wheel button is typically . Additional buttons are given higher numbers.
  • The following refer to modifier keys:
"ModifierKeys"a list of all modifier keys currently being pressed
"AltKey"True if the Alt or Cmd key is currently pressed
"CommandKey"True if the Alt or Cmd key is currently pressed
"ControlKey"True if the Ctrl key is currently pressed
"OptionKey"True if the Option key on a Macintosh is currently pressed
"ShiftKey"True if the Shift key is currently pressed
  • The following refer to controller devices such as gamepads:
"ControllerData"low-level data on states of all controllers
{"ControllerData",ids}data on controllers with the specified identifiers
  • The following refer to the event or action currently being handled:
"EventKey"key that was pressed
"EventAbsoluteTime"absolute time when the event occurred
"EventData"data about the event
  • The following refer to the evaluation currently being performed:
"DynamicEvaluation"True if the evaluation is associated with Dynamic
"SynchronousEvaluation"True if the evaluation is being performed synchronously
  • The following special items refer to the complete current notebook:
"NotebookDirectory"directory name
"NotebookFileName"name of file, without path
"NotebookFullFileName"full file name, including path
"NotebookSelected"True if the notebook is selected
  • The following refer to the font being used; all are given in printer's points:
"FontAscenderHeight"height of ascenders for lowercase letters
"FontAxisOffset"offset of the font axis above the baseline
"FontCapHeight"height of capital letters
"FontDescenderDepth"depth of descenders for lowercase letters
"FontLineHeight"total height of lines of text
"FontMWidth"width of an "m"
"FontNWidth"width of an "n"
"FontThickness"default stroke thickness
"FontXHeight"height of an "x"
  • The following refer to system font settings:
"ControlsFontFamily"font family for system controls
"ControlsFontSize"default font size for system controls
"PanelFontFamily"font family for system panels
"PanelFontSize"default font size for system panels
$FrontEndthe whole front end session
InputNotebook[]the currently selected notebook
EvaluationNotebook[]the notebook in which the current evaluation is occurring
NotebookSelection[nb]the current selection within a notebook
Get the current mouse position:
Dynamically update the current value:
Get the current mouse position:
In[1]:=
Click for copyable input
Out[1]=
 
Dynamically update the current value:
In[1]:=
Click for copyable input
Out[1]=
Get the current value of an option for the front end:
Get the current value of an option for a notebook:
Get the current value of an option inherited by a Dynamic:
Get the current value of a suboption:
Get the current value of a specific rule within an option:
Get the current value of rules within rules within options:
Use platform-specific controls font:
Use platform-specific panel font:
Detect whether the mouse cursor is over the content:
Get the absolute current position of the mouse on screen:
Get the scaled current position of the mouse on screen:
Get the mouse position inside a graphic:
Check whether the current notebook is selected:
Get the notebook file name:
Get a list of all modifier keys being pressed:
Check whether a specific modifier key is being pressed:
Detect whether current cell is selected:
Get the box structure of the selection in this notebook:
Select parts of the expression below:
Detect whether current evaluation is inside Dynamic:
Detect whether current evaluation is synchronous:
Set the notebook background to be red for a second and then reset to original value:
Use Dynamic to set the notebook background:
Or set the window opacity:
Use the TaggingRules option to store arbitrary metadata that will be saved with a notebook:
See the entire list of TaggingRules for a given selector:
Use TaggingRules to emulate a DynamicModule construct that can span cells:
Mouseover is created by the CurrentValue item :
Dynamic may not be updated while mouse buttons are down, so this may show nothing:
New in 6