Skip to Main Content Skip to Search
Product Documentation

unregisterallevents - Unregister all event handlers associated with COM object events at run time

Syntax

h.unregisterallevents
unregisterallevents(h)

Description

h.unregisterallevents unregisters all events previously registered with COM object h. After calling unregisterallevents, the object no longer responds to any events until you register them again using the registerevent function.

unregisterallevents(h) is an alternate syntax.

COM functions are available on Microsoft Windows systems only.

Examples

Register and unregister events for an instance of the mwsamp control, using the eventlisteners function to see the event handler associated with each event:

  1. Register three events and their respective handler routines.

    f = figure ('position', [100 200 200 200]);
    h = actxcontrol('mwsamp.mwsampctrl.2', ...
        [0 0 200 200], f, ... 
        {'Click' 'myclick'; 'DblClick' 'my2click'; ... 
        'MouseDown' 'mymoused'});
    h.eventlisteners
    

    MATLAB displays:

    ans = 
        'click'        'myclick' 
        'dblclick'     'my2click'
        'mousedown'    'mymoused'
    
  2. Unregister all events simultaneously with unregisterallevents. eventlisteners returns an empty cell array, indicating that there are no longer any events registered with the control:

    h.unregisterallevents;
    h.eventlisteners
    

    MATLAB displays:

    ans = 
         {}
    

See Also

eventlisteners | events (COM) | isevent | registerevent | unregisterevent

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS