TrackingFunction

TrackingFunction

is an option for Manipulate controls that specifies functions to use during interactive changing or editing.

Details

  • TrackingFunction gives access to the second argument of Dynamic in the underlying control.
  • The Manipulate argument {u,,TrackingFunction->f} represents a control that continually evaluates f[val,u] during interactive changing or editing of val.
  • The default setting of TrackingFunction is equivalent to (u=#)&.
  • TrackingFunction can be set to a function or a list of up to three functions.
  • For interactive mouse operations, TrackingFunction->{fstart,f,fend} typically evaluates fstart[val,u] once when the mouse is pressed, then evaluates f[val,u] whenever the mouse is moved, and then evaluates fend[val,u] once the mouse is released.

Examples

open allclose all

Basic Examples  (2)

TrackingFunction can be used to set more than one variable at a time:

TrackingFunction can be used to enforce restrictions on a control:

Two-dimensional controls like Locator can be restricted to regions:

Locator tracking functions can make use of CurrentValue["CurrentLocatorPaneThumb"] to enforce different restrictions on different points:

Possible Issues  (1)

The TrackingFunction is only active when interacting with the control. Changing the variable in other ways will not pass through the TrackingFunction:

Introduced in 2014
 (10.0)