External Interfaces Reference |
Return list of events attached to listeners
Syntax
Description
C = h.eventlisteners
lists any events, along with their event handler routines, that have been registered with control, h
. The function returns cell array of strings C
, with each row containing the name of a registered event and the handler routine for that event. If the control has no registered events, then eventlisteners
returns an empty cell array.
Events and their event handler routines must be registered in order for the control to respond to them. You can register events either when you create the control, using actxcontrol, or at any time afterwards, using registerevent.
C = eventlisteners(h)
is an alternate syntax for the same operation.
Examples
Create an mwsamp
control, registering only the Click
event. eventlisteners
returns the name of the event and its event handler routine, myclick
:
f = figure('position', [100 200 200 200]); h = actxcontrol('mwsamp.mwsampctrl.2', [0 0 200 200], f, ... {'Click' 'myclick'}); h.eventlisteners ans = 'click' 'myclick'
Register two more events: DblClick
and MouseDown
. eventlisteners
returns the names of the three registered events along with their respective handler routines:
h.registerevent({'DblClick', 'my2click'; ... 'MouseDown' 'mymoused'}); h.eventlisteners ans = 'click' 'myclick' 'dblclick' 'my2click' 'mousedown' 'mymoused'
Now unregister all events for the control. eventlisteners
returns an empty cell array, indicating that no events have been registered for the control:
See Also
events
, registerevent
, unregisterevent
, unregisterallevents
, isevent
deleteproperty | events |
© 1994-2005 The MathWorks, Inc.