NotebookEventActions

NotebookEventActions
is a notebook option that gives a list of actions to perform when specified events occur in connection with the notebook.

DetailsDetails

  • NotebookEventActions->{"event1":>action1, "event2":>action2, ...} specifies that should be evaluated whenever occurs in connection with the notebook.
  • The possible event specifications are the same as for EventHandler, with the following addition:
  • "WindowClose"window being closed
  • Settings for NotebookEventActions are often defined at the level of stylesheets, rather than for individual notebooks.
  • By default, any action specified for an event by NotebookEventActions will override any default action that Mathematica would take for that event.
  • The default behavior can be changed by including rules for PassEventsDown or PassEventsUp in the list given as the setting for NotebookEventActions.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

Set up a certain action to take place when a notebook is closed:

In[1]:=
Click for copyable input

With the notebook open, is unchanged:

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

When you close the notebook window, is incremented:

In[4]:=
Click for copyable input
Out[4]=
New in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »