External Interfaces/API Reference    
actxcontrol

Create a COM 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].

fig_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. See the section, Writing Event Handlers in the External Interfaces documentation 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. See Writing Event Handlers in the External Interfaces documentation for more information on handling control events.

filename
   The name of a file to which a previously created control has been saved. When you specify filename, MATLAB creates a new control using the position, handle, and event/eventhandler arguments, and then initializes the control from the specified file. The progid argument in actxcontrol must match the progid of the saved control.

Description

Create a COM control at a particular location within a figure window. If the parent figure window is invisible, the control will be invisible. The returned COM 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.)

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

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

Examples

Basic Control Methods

Create a control that runs Microsoft's Calendar application:

Call the get method on cal to list all properties of the Calendar:

Read just one property to record today's date:

Set the Day property to a new value:

Calling invoke with no arguments lists all available methods:

Invoke the NextWeek method to advance the current date by one week:

Call events to list all Calendar events that can be triggered:

Set Up Event Handling

See the section, Sample Event Handlers in the External Interfaces documentation for examples of event handler functions and how to register them with MATLAB.

See Also

actxserver, release, delete, save, load


   COM Functions actxserver