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 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 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 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.
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
events
| registerevent
| eventlisteners
| unregisterevent
| unregisterallevents