Initialization

Initialization

is an option for Dynamic, DynamicModule, Manipulate, and related constructs that specifies an expression to be evaluated when the construct is first displayed.

Details

  • The typical usage is Initialization:>expr.
  • Initialization expressions defined in particular cells in a notebook are evaluated when those cells are first made visible, and not necessarily when the notebook is first opened.
  • Initialization expressions are guaranteed to be evaluated exactly once before the body of the main function is resolved.
  • An object that is already initialized can be initialized again if it is deleted, then restored as a result of using Undo.

Examples

open allclose all

Basic Examples  (3)

Specify an expression to be evaluated before displaying Dynamic:

In[1]:=
Click for copyable input
Out[1]=

DynamicModule:

In[1]:=
Click for copyable input
Out[1]=

Manipulate:

In[1]:=
Click for copyable input
Out[1]=Play Animation

Properties & Relations  (3)

Possible Issues  (3)

See Also

Deinitialization  InitializationCell  CellDynamicExpression

Introduced in 2007
(6.0)