|MATLAB Function Reference|
Unregister an event handler with a control's event
Handle for a MATLAB COM control object.
Name of an M-function previously registered with this object to handle events. Callbacks are registered using either
Any event associated with
h that can be triggered. Specify
event using the event name. Unlike
unregisterevent does not accept numeric event identifiers.
Name of the event handler routine that you want to unregister for the event specified in the preceding
Unregister the specified
callback routines with all events for this control, or unregister each specified
eventhandler routine with the
event associated with it in the argument list. Once you unregister a callback or event handler routine, MATLAB no longer responds to the event using that routine.
The strings specified in the
eventhandler arguments are not case sensitive.
You can unregister events at any time after a control has been created.
mwsamp control and register all events with the same callback routine,
sampev. Use the eventlisteners function to see the event handler used by each event. In this case, each event, when fired, will call
Unregister just the
dblclick event. Now, when you list the registered events using
eventlisteners, you see that
dblclick is no longer registered. The control will no longer respond when you double-click the mouse over it:
This time, register the
dblclick events with a different event handler for each:
You can unregister these same events by specifying event names and their handler routines in a cell array. Note that
eventlisteners now returns an empty cell array, meaning that no events are registered for the
In this last example, you could have used unregisterallevents instead: