DynamicWrapper

DynamicWrapper[e,expr]

represents an object that displays as e, but dynamically updates the expression expr whenever that object is visible on screen.

Details and Options

  • The displayed e is not treated as dynamic, although it can contain explicit Dynamic expressions.
  • The expression expr is not displayed anywhere.
  • DynamicWrapper has the attribute HoldRest.
  • DynamicWrapper takes the same options as Dynamic.
  • List of all options

Examples

open allclose all

Basic Examples  (1)

Display static content while dynamically updating an expression:

Assign a value to the independent variable above:

Display the dependent and independent variables:

Scope  (3)

The same constructs which control evaluation in Dynamic work in DynamicWrapper:

The first argument can contain a Dynamic, which may interact with the DynamicWrapper evaluation:

Unlike Dynamic, DynamicWrapper cannot be used as an argument to a control:

Properties & Relations  (3)

As with Dynamic, a DynamicWrapper will not evaluate its contents if it is not displayed:

CompoundExpression in a Dynamic can be used to evaluate multiple expressions:

DynamicWrapper instead resolves its first argument at the time TemplateBox[{shift, return}, Key1, BaseStyle -> {ExampleText, FontWeight -> Plain, FontFamily -> Source Sans Pro}] is pressed:

Initialization sets an evaluation that will only happen a single time at Dynamic creation:

DynamicWrapper sets an evaluation that may happen repeatedly:

Possible Issues  (1)

DynamicWrapper will only update its computation while being displayed:

Wolfram Research (2010), DynamicWrapper, Wolfram Language function, https://reference.wolfram.com/language/ref/DynamicWrapper.html.

Text

Wolfram Research (2010), DynamicWrapper, Wolfram Language function, https://reference.wolfram.com/language/ref/DynamicWrapper.html.

CMS

Wolfram Language. 2010. "DynamicWrapper." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DynamicWrapper.html.

APA

Wolfram Language. (2010). DynamicWrapper. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DynamicWrapper.html

BibTeX

@misc{reference.wolfram_2024_dynamicwrapper, author="Wolfram Research", title="{DynamicWrapper}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/DynamicWrapper.html}", note=[Accessed: 24-June-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_dynamicwrapper, organization={Wolfram Research}, title={DynamicWrapper}, year={2010}, url={https://reference.wolfram.com/language/ref/DynamicWrapper.html}, note=[Accessed: 24-June-2024 ]}