Skip to Main Content Skip to Search
Product Documentation

eventlisteners - List event handler functions associated with COM object events

Syntax

info = h.eventlisteners
info = eventlisteners(h)

Description

info = h.eventlisteners lists the events and their event handler routines registered with COM object h. The function returns a cell array of strings info, with each row containing the name of a registered event and the handler routine for that event. If the object has no registered events, eventlisteners returns an empty cell array. You can register events either when you create the control, using actxcontrol, or at any time afterwards, using registerevent.

info = eventlisteners(h) is an alternate syntax.

COM functions are available on Microsoft Windows systems only.

Examples

Manage events for an instance of the MATLAB control mwsamp:

f = figure('position', [100 200 200 200]);
%Create an mwsamp control and 
%register the Click event
h = actxcontrol('mwsamp.mwsampctrl.2', ...
    [0 0 200 200], f, ...
    {'Click' 'myclick'});
h.eventlisteners

MATLAB displays the event name and its event handler, myclick:

ans = 
    'Click'    'myclick'
 

Register two more events, DblClick and MouseDown:

h.registerevent({'DblClick', 'my2click'; 'MouseDown' 'mymoused'});
h.eventlisteners

MATLAB displays all event names and handlers:

ans = 
    'Click'        'myclick' 
    'Dblclick'     'my2click'
    'Mousedown'    'mymoused'
 

Unregister all events for the control:

h.unregisterallevents
h.eventlisteners

MATLAB displays an empty cell array, indicating the control has no registered events:

ans = 
     {}

See Also

actxcontrol | events (COM) | isevent | registerevent | unregisterallevents | 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