Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

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

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS