NotebookEventActions

NotebookEventActions

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

Details

  • NotebookEventActions->{"event1":>action1,"event2":>action2,} specifies that actioni should be evaluated whenever "eventi" 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 the Wolfram System 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.

Examples

open allclose all

Basic Examples  (1)

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

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

With the notebook open, k is unchanged:

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

When you close the notebook window, k is incremented:

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

Scope  (3)

Possible Issues  (3)

See Also

EventHandler  CellEventActions  FrontEndEventActions

Introduced in 2007
(6.0)