REMOVEHANDLER
Unregister a registered event handler
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
|
|
REMOVEHANDLER(event, method_name)
or
event -= method_name
Arguments
event
The name of an event or (in traditional Synergy only) an object reference to a field that is of the type Synergex.SYNNET.DotNetEvent or inherited from Synergex.SYNNET.DotNetEvent.
method_name
In Synergy .NET, the name of the method that handles the event (including the class for a static method or instance for a non-static method), or an instance of a delegate pointing to such a method. In traditional Synergy, an instance of a Synergex.SYNNET.DotNetDelegate object (or of a class inherited from Synergex.SYNNET.DotNetDelegate) pointing to a method that handles the event.
Discussion
The REMOVEHANDLER statement removes a registered event. In traditional Synergy, REMOVEHANDLER can only be used with code generated by the gennet40 utility.
In Synergy .NET, Method_name is in the form instance.method. For example, if c1 is an instance of class1, method_name could be any of the following:
- c1.mymeth
- this.mymeth (for this instance in a class)
- parent.mymeth (for the parent’s instance in a class)
When the event goes out of scope, all the methods registered for the event are automatically unregistered.
If you use REMOVEHANDLER for an event handler that has not been previously registered, the statement will be ignored.
See also
- EVENT statement
- ADDHANDLER statement
- RAISEEVENT statement
Examples
See ADDHANDLER.