isevent - True if COM object event

Syntax

tf = h.isevent('name')
tf = isevent(h, 'name')

Description

tf = h.isevent('name') returns logical 1 (true) if the specified name is an event that can be recognized and responded to by COM object h. Otherwise, isevent returns logical 0 (false) .

tf = isevent(h, 'name') is an alternate syntax for the same operation.

Remarks

The string specified in the name argument is not case sensitive.

For COM control objects, isevent returns the same value regardless of whether the specified event is registered with the control or not. In order for the control to respond to the event, you must first register the event using either actxcontrol or registerevent.

Examples

Test an Event Example

Create an mwsamp control and test to see if DblClick is an event recognized by the control.

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

MATLAB® displays ans = 1 (true), showing that DblClick is an event.

Test a Method Example

Try the same test on Redraw, which is one of the control's methods.

h.isevent('Redraw')

MATLAB displays ans = 0 (false), showing that Redraw is not an event.

Test Workbook Event Example

Create a Microsoft® Excel® Workbook object.

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

Test the Activate event:

wb.isevent('Activate')

MATLAB displays ans = 1 (true), showing that Activate is an event.

Test Save :

wb.isevent('Save')

MATLAB displays ans = 0 (false), showing that Save is not an event; it is a method.

See Also

events (COM), eventlisteners, registerevent, unregisterevent, unregisterallevents

  


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