External Interfaces/API    
actxcontrol

Create an ActiveX control in a figure window.

Syntax

Arguments
progid
   String that is the name of the control to create. The control vendor provides this string.

position
   Position vector containing the x and y location and the xsize and ysize of the control, expressed in pixel units as [x y xsize ysize]. Defaults to [20 20 60 60].

handle
   Handle Graphics handle of the figure window in which the control is to be created. If the control should be invisible, use the handle of an invisible figure window. Defaults to gcf.

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; the first argument is always a string that represents the numerical value of the event that was triggered. These numerical values are defined by the control. (See the section, Writing Event Handlers," for more information on handling control events.)

event
   Triggered event specified by either number or 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. The first argument is the activex object, the second number represents the numerical value of the event that was triggered. Note that the second number is not converted to a string as is the case in the "callback" M-file style. These values are defined by the control. See Writing Event Handlers for more information on handling control events.

Returns

A MATLAB activex object that represents the default interface for this control or server. Use the get, set, invoke, propedit, release, and delete methods on this object. A MATLAB error will be generated if this call fails.

Description

Create an ActiveX control at a particular location within a figure window. If the parent figure window is invisible, the control will be invisible. The returned MATLAB activex object represents the default interface for the control. This interface must be released through a call to release when it is no longer needed to free the memory and resources used by the interface. Note that releasing the interface does not delete the control itself (use the delete command to delete the control.)

For an example callback event handler, see the file sampev.m in the toolbox\matlab\winfun directory.

Example

Callback style:

Cell array style:

where the event handlers, myclick.m, my2click.m, and mymoused.m are

You can use the same event handler for all the events you want to monitor using the cell array pairs. Response time will be better than using the callback style.

For example

and allevents.m is


 ActiveX Client Reference actxserver