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