Documentation Center

  • Trial Software
  • Product Updates



List event handler functions associated with COM object events


info = h.eventlisteners
info = eventlisteners(h)


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.


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'});
ans = 
    'Click'    'myclick'

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


Register two more events, DblClick and MouseDown:

h.registerevent({'DblClick', 'my2click'; 'MouseDown' 'mymoused'});
ans = 
    'Click'        'myclick' 
    'Dblclick'     'my2click'
    'Mousedown'    'mymoused'

MATLAB displays all event names and handlers.


Unregister all events for the control:

ans = 

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

See Also

| | | | |

Was this topic helpful?