assigns the specified Wolfram Language function func to be called when the given event event fires.


  • To use AddEventHandler, you first need to load .NET/Link using Needs["NETLink`"].
  • AddEventHandler can be used to wire up Wolfram Language callbacks for events in .NET user interfaces, such as a button click.
  • The following options can be given:
  • SendDelegateArgumentsAllwhich delegate arguments to send to the Wolfram Language event handler function
    CallsUnshareFalsewhether or not your event handler function calls the advanced function UnshareKernel
  • The function argument can be a string, a symbol naming a Wolfram Language function, or a pure function, and it will be called with whatever arguments the event sends.
  • AddEventHandler returns a delegate object that can be passed to RemoveEventHandler to remove the callback function.
  • Alternatively, use NETNewDelegate to manually create a delegate and pass that as the second argument instead of the function.
Translate this page: