Skip to Main Content Skip to Search
Product Documentation

events (COM) - List of events COM object can trigger

Syntax

S = h.events
S = events(h)

Description

S = h.events returns structure array S containing all events, both registered and unregistered, known to the COM object, and the function prototype used when calling the event handler routine. For each array element, the structure field is the event name and the contents of that field is the function prototype for that event's handler.

S = events(h) is an alternate syntax.

Tips

COM functions are available on Microsoft Windows systems only.

Examples

List Control Events Example

Create an mwsamp control and list all events:

f = figure ('position', [100 200 200 200]);
h = actxcontrol ('mwsamp.mwsampctrl.2', [0 0 200 200], f);
h.events

MATLAB software displays information similar to:

Click = void Click()
DblClick = void DblClick()
MouseDown = void MouseDown(int16 Button, int16 Shift,
  Variant x, Variant y)
Event_Args = void Event_Args(int16 typeshort, int32 typelong,
  double typedouble, string typestring, bool typebool)

Assign the output to a variable and get one field of the returned structure:

ev = h.events;
ev.MouseDown

MATLAB displays:

ans =
  void MouseDown(int16 Button, int16 Shift, Variant x, Variant y)

List Workbook Events Example

Open a Microsoft Excel application and list all events for a Workbook object:

myApp = actxserver('Excel.Application');
wbs = myApp.Workbooks;
wb = wbs.Add;
wb.events

The MATLAB software displays all events supported by the Workbook object.

	Open = void Open()
	Activate = void Activate()
	Deactivate = void Deactivate()
	BeforeClose = void BeforeClose(bool Cancel)
                 .
                 .

See Also

eventlisteners | isevent | registerevent | unregisterallevents | unregisterevent

  


» Learn more
» Download free kit
» Get trial software

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