これは,Wolfram言語の以前のバージョンに基
づくMathematica 6のためのドキュメントです.
最新のドキュメント(バージョン11.1)もご覧ください.

AddEventHandler

AddEventHandler[obj@event, func]
assigns the specified Mathematica function func to be called when the given event event fires.
  • 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.