Deinitialization

Deinitialization

is an option for Dynamic, DynamicModule, Manipulate, and related constructs that specifies an expression to be evaluated when the construct can no longer be displayed or used.

Details

  • The typical usage is Deinitialization:>expr.
  • Deinitialization is typically done when the cell containing a construct is deleted, or when the notebook containing it is closed.
  • Deinitialization will never be performed unless initialization has previously been performed.
  • Deinitialization may be delayed if, for example, a construct appears in an invisible location such as the clipboard.
  • An object that has been deinitialized can be initialized again if it is restored as a result of using Undo. It may be deinitialized again through the use of Redo or any other action that deletes the object.

Examples

open all close all

Basic Examples  (3)

Choose a color and create the colored disk when the window is closed:

In[1]:=
Click for copyable input

Temporarily change the background of a notebook:

In[1]:=
Click for copyable input

Track and display how long a window was viewed:

In[1]:=
Click for copyable input

Scope  (2)

Properties & Relations  (1)

Neat Examples  (1)

Introduced in 2007
(6.0)