This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


List event handler functions associated with COM object events


info = eventlisteners(h)


info = eventlisteners(h) lists the events and their event handler routines registered with COM object h. The function returns a cell array of character vectors 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 afterward, using registerevent.

COM functions are available on Microsoft® Windows® systems only.


This example manages events for 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:

registerevent(h,{'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.

Introduced before R2006a

Was this topic helpful?