This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

registerevent

Associate event handler for COM object event at run time

Syntax

registerevent(c,eventhandler)

Description

example

registerevent(c,eventhandler) registers event handler routines with their corresponding events.

Examples

collapse all

Register all events in the mwsamp control with the same event handler routine sampev.

f = figure('position',[100 200 200 200]);
C = actxcontrol('mwsamp.mwsampctrl.2',[0 0 200 200],f);
registerevent(C,'sampev')
eventlisteners(C)
ans =

  4×2 cell array

    'Click'         'sampev'
    'DblClick'      'sampev'
    'MouseDown'     'sampev'
    'Event_Args'    'sampev'
C = actxcontrol('mwsamp.mwsampctrl.2',[0 0 200 200]); 
registerevent(C,{'Click' @myclick})
eventlisteners(C)
ans =

  1×2 cell array

    'Click'    @myclick

Input Arguments

collapse all

COM object, specified as a function handle.

Function to call when an event occurs, specified as a string or a character vector naming the function or a function handle that maps to that function. Strings and character vectors are not case-sensitive.

Limitations

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

Introduced before R2006a