This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

COM Events

An event is typically a user-initiated action that takes place in a server application, which often requires a reaction from the client. For example, if you click the mouse at a particular location in a server interface window, the client application can respond. When an event is fired, the server communicates this occurrence to the client. If the client is listening for this particular type of event, it responds by executing a routine called an event handler.

The MATLAB® COM client can subscribe to and handle the events fired by a Microsoft® ActiveX® control or a COM server. Select the events you want the client to listen to. Register each event with an event handler to be used in responding to the event. When a registered event takes place, the control or server notifies the client, which responds by executing the appropriate event handler routine. You can write event handlers as MATLAB functions.

To identify events the control or server can respond to, use the events function.

To register events you want to respond to, use the registerevent function. The MATLAB client responds only to events you have registered. If you register the same event name to the same callback handler multiple times, MATLAB executes the event only once.

For ActiveX controls, you can register events at the time you create an instance of the control using the actxcontrol function.

To identify registered events, use the eventlisteners function.

To respond to events as they occur, create event handlers that have been registered for that event. You can implement these routines as MATLAB functions.

To unregister events you no longer want to listen to, use the unregisterevent or unregisterallevents function.

    Note:   MATLAB does not support asynchronous events.

    Note:   MATLAB does not support interface events from a Custom server.

See Also

| | | | |

Related Examples

More About

Was this topic helpful?