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 allclose all

Basic Examples  (3)

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

Temporarily change the background of a notebook:

Track and display how long a window was viewed:

Scope  (2)

Track the mouse position while the window is open and display a plot when it is closed:

Temporarily change the notebook font size setting:

Properties & Relations  (1)

Each time a Dynamic destroys a deinitializing construct, the deinitialization will run again:

Neat Examples  (1)

Display the current time and create a graphical representation when the window is closed:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_deinitialization, author="Wolfram Research", title="{Deinitialization}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Deinitialization.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_deinitialization, organization={Wolfram Research}, title={Deinitialization}, year={2007}, url={https://reference.wolfram.com/language/ref/Deinitialization.html}, note=[Accessed: 21-December-2024 ]}