|MATLAB Function Reference|
Create a COM control in a figure window
String that is the name of the control to create. The control vendor provides this string.
Position vector containing the
y location and the
ysize of the control, expressed in pixel units as
[x y xsize ysize]. Defaults to
[20 20 60 60].
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
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.
Triggered event specified by either number or name.
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.
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
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.
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
eventhandler arguments are not case sensitive.
There are two ways to handle events. You can create a single handler (|
For an example callback event handler, see the file
sampev.m in the
Basic Control Methods
Create a control that runs Microsoft's Calendar application:
get method on
cal to list all properties of the Calendar:
Read just one property to record today's date:
Day property to a new value:
invoke with no arguments lists all available methods:
NextWeek method to advance the current date by one week:
events to list all Calendar events that can be triggered:
events(cal) ans = Click = void Click() DblClick = void DblClick() KeyDown = void KeyDown(int16 KeyCode, int16 Shift) KeyPress = void KeyPress(int16 KeyAscii) KeyUp = void KeyUp(int16 KeyCode, int16 Shift) BeforeUpdate = void BeforeUpdate(int16 Cancel) AfterUpdate = void AfterUpdate() NewMonth = void NewMonth() NewYear = void NewYear()
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.