Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

AddEventHandler

AddEventHandler[obj@event, func]
assigns the specified Mathematica 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 Mathematica 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 Mathematica 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 Mathematica 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.
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team