External Interfaces/API Reference    
registerevent (COM)

Register an event handler with a control's event

Syntax

Arguments

h
   Handle for a MATLAB COM control object.

callback
   Name of an M-function that accepts a variable number of arguments. This function will be called whenever the control triggers an event. Each argument is converted to a MATLAB string. See the section, Writing Event Handlers in the External Interfaces/API documentation for more information on handling control events.

event
   Any event associated with h that can be triggered. Specify event using the event name.

eventhandler
   Name of an M-function that accepts a variable number of arguments. This function will be called whenever the control triggers the event associated with it. See Writing Event Handlers in the External Interfaces/API documentation for more information on handling control events.

Description

Register one or more events with a single callback function or with a separate handler function for each event. You can either register events at the time you create the control (using actxcontrol), or register them dynamically at any time after the control has been created (using registerevent).

The strings specified in the callback, event, and eventhandler arguments are not case sensitive.

Examples

Create an mwsamp control and list all events associated with the control:

Register all events with the same callback routine, sampev. Use the eventlisteners function to see the event handler used by each event:

Register the Click and DblClick events with event handlers myclick and my2click, respectively:

See Also

events, eventlisteners, unregisterevent, unregisterallevents, isevent


  propedit (COM) release (COM)