External Interfaces/API Reference    
unregisterevent (COM)

Unregister an event handler with a control's event

Syntax

Arguments

h
   Handle for a MATLAB COM control object.

callback
   Name of an M-function previously registered with this object to handle events. Callbacks are registered using either actxcontrol or registerevent.

event
   Any event associated with h that can be triggered. Specify event using the event name. Unlike actxcontrol, unregisterevent does not accept numeric event identifiers.

eventhandler
   Name of the event handler routine that you want to unregister for the event specified in the preceding event argument.

Description

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 callback, event, and eventhandler arguments are not case sensitive.

You can unregister events at any time after a control has been created.

Examples

Create an 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 sampev.m:

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 click and dblclick events with a different event handler for each: myclick and my2click, respectively:

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 mwsamp control:

In this last example, you could have used unregisterallevents instead:

See Also

events, eventlisteners, registerevent, unregisterallevents, isevent


  unregisterallevents (COM)  DDE Functions