Contents

isevent

Determine whether input is COM object event

Syntax

tf = isevent(h,'eventname')

Description

tf = isevent(h,'eventname') returns logical 1 (true) if eventname is an event recognized by COM object h. Otherwise, returns logical 0 (false). The eventname argument is not case-sensitive.

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

Examples

This example tests events in a MATLAB® sample control object.

  1. Create an instance of the mwsamp control and test DblClick.

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

    MATLAB displays true, indicating DblClick is an event.

  2. Try the same test onRedraw.

    isevent(h,'Redraw')

    MATLAB displays false, indicating Redraw is not an event; it is a method.

Test events in a Microsoft Excel® workbook object.

  1. Create a Workbook object wb

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

    isevent(wb,'Activate')

    MATLAB displays true, indicating Activate is an event.

  3. Test Save

    isevent(wb,'Save')

    MATLAB displays false, indicating Save is not an event; it is a method.

Was this topic helpful?