Documentation Center

  • Trial Software
  • Product Updates

Contents

isevent

Determine whether input is COM object event

Syntax

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

Description

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

tf = isevent(h, 'eventname') is an alternate syntax.

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

Examples

Test 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);
    h.isevent('DblClick')

    MATLAB displays true, indicating DblClick is an event.

  2. Try the same test onRedraw:

    h.isevent('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 = wbs.Add;
  2. Test Activate:

    wb.isevent('Activate')

    MATLAB displays true, indicating Activate is an event.

  3. Test Save:

    wb.isevent('Save')

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

See Also

| |

Was this topic helpful?