Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
27
Добавлен:
09.02.2015
Размер:
111.62 Кб
Скачать

Values, matlab returns an empty cell array in the corresponding

structure field value.

Equivalent syntax is

S = OBJ.SET

SET(OBJ, PROPERTY) returns the possible values for the specified

property of COM object OBJ. The returned array is a cell array of

possible value strings or an empty cell array if the property does not

have a finite set of possible values.

SET(OBJ, PROPERTYNAME, VALUE) sets the value of the specified property for COM object OBJ.OBJ can be a vector of COM objects, in which case SET sets

the property values for all the COM objects specified.

Equivalent syntax is

S = OBJ.PROPERTY(VALUE)

SET(OBJ, PROPERTYNAME1, VALUE1, PROPERTYNAME2, VALUE2,...) sets multiple property values with a single statement.

Example:

h = actxcontrol ('mwsamp.mwsampctrl.1';

h.set('Label', 'Click to fire event'); %OR h.Label('Click to fire

event')

h.set('Label', 'Click to fire event', 'Radius', 40);

h = actxserver('Excel.Application');

h.set

h.set('Cursor') %OR h.Cursor

See also COM/get, COM/addproperty, COM/deleteproperty.

<COM/get> - Get COM object properties.

GET Get COM object properties.

GET(OBJ) displays all property names and their current values for

COM object OBJ.

Equivalent syntax is

S = OBJ.GET

S = GET(OBJ) returns a structure, S, where each field name is the

name of a property of OBJ and each field contains the value of that

property.

S = GET(OBJ, PROPERTY) returns the value of the specified

property for COM object OBJ. PROPERTY is a quoted string

containing the property name.

Equivalent syntax is

S = OBJ.PROPERTY

S = GET(OBJ, PROPERTY, VALUE1, VALUE2, ...) returns the value of

the specified property that takes arguments VALUE1, VALUE2, etc.

Example:

e = actxserver('Excel.Application');

e.get('Path') OR e.Path

e.get

See also COM/set, COM/INSPECT, COM/ISPROP, COM/addproperty,

COM/deleteproperty.

<COM/invoke> - Invoke method on object or interface, or display methods.

Invoke Invoke method on object or interface, or display methods.

S = INVOKE(OBJ) returns structure array S containing a list of

all methods supported by the object or interface OBJ along

with the prototypes for these methods.

Equivalent syntax is

S = OBJ.INVOKE

S = INVOKE(OBJ, METHOD) invokes the method specified in the

string METHOD, and returns an output value, if any, in S.

The data type of the return value is dependent upon the specific

method being invoked and is determined by the specific control

or server.

Equivalent syntax is

S = OBJ.METHOD %(if typelibrary is available)

S = INVOKE(OBJ, METHOD, ARG1, ARG2, ...) invokes the method

specified in the string METHOD with input arguments ARG1,

ARG2, etc.

S = INVOKE(OBJ, CUSTOMINTERFACENAME) returns an Interface object

that serves as a handle to a custom interface implemented by the

COM component, OBJ. The CUSTOMINTERFACENAME argument is a quoted string returned by the INTERFACES function.

S = INVOKE(OBJ, GUID) returns an Interface object that serves as a

handle to a custom interface implemented by the COM component, OBJ.

The GUID argument is a quoted string that represents the 128 bit number

of a particular Interface or COClass.

Example:

h = actxcontrol ('mwsamp.mwsampctrl.1');

s = h.invoke;

h.set('Radius', 100);

h.invoke('Redraw'); %OR h.Redraw

h = actxserver('mytestenv.calculator');

customlist = h.interfaces;

customlist =

ICalc1

ICalc2

ICalc3

%Get custom interface ICalc

c1 = h.invoke('ICalc1');

%Get custom interface represented by the following CoClass GUID

c2 = h.invoke('BC660790-3FE2-4679-B2BA-84B6723A14C1');

See also COM/interfaces.

<COM/events> - Return list of events the COM object can trigger.

EVENTS Return list of events the COM object can trigger.

S = EVENTS(OBJ) returns structure array S containing all events, both

registered and unregistered, known to the object, and the function

prototype used when calling the event handler routine. For each array

element, the structure field is the event name and the contents of that

field is the function prototype for that event's handler.

Equivalent syntax is

S = OBJ.EVENTS

Example:

h = actxserver('Excel.Application');

s = h.events;

See also winfun/isevent, winfun/eventlisteners, winfun/registerevent,

winfun/unregisterevent, winfun/unregisterallevents.

<COM/interfaces> - List custom interfaces supported by a COM server.

INTERFACES List custom interfaces supported by a COM server.

S =INTERFACES(OBJ) returns cell array of strings S listing all custom

interfaces implemented by the component in a specific COM server. The

server is designated by input argument, OBJ, which is the handle

returned by the ACTXCONTROL or ACTXSERVER function when creating that server.

Equivalent syntax is

S = OBJ.INTERFACES

h = actxserver('mytestenv.calculator')

h =

COM.mytestenv.calculator

customlist = h.interfaces

customlist =

ICalc1

ICalc2

ICalc3

See also winfun/actxserver, winfun/actxcontrol.

<COM/addproperty> - Add custom property to an object.

ADDPROPERTY Add custom property to a COM object.

ADDPROPERTY(OBJ, PROPERTYNAME) adds the custom property specified in the string, PROPERTYNAME, to the object or interface, OBJ. Use SET to assign a value to the property.

Equivalent syntax is

OBJ.ADDPROPERTY(PROPERTYNAME)

Example:

%Create an mwsamp control and add a new property named Position to it.

%Assign an array value to the property

f = figure('position', [100 200 200 200]);

h = actxcontrol('mwsamp.mwsampctrl.2', [0 0 200 200], f);

h.get

Label: 'Label'

Radius: 20

h.addproperty('Position');

h.set('Position', [200 120]);

h.get

Label: 'Label'

Radius: 20

Position: [200 120]

h.get('Position')

ans =

200 120

See also COM/deleteproperty, COM/get, COM/set

<COM/deleteproperty> - Remove custom property from object.

DELETEPROPERTY Remove custom property from a COM object.

DELETEPROPERTY(OBJ, PROPERTYNAME) deletes the property specified in the string PROPERTYNAME from the custom properties belonging to object or

interface, OBJ.

Equivalent syntax is

OBJ.DELETEPROPERTY(PROPERTYNAME)

Example:

%Create an mwsamp control and add a new property named Position to it.

%Assign an array value to the property and delete it using

%deleteproperty.

f = figure('position', [100 200 200 200]);

h = actxcontrol('mwsamp.mwsampctrl.2', [0 0 200 200], f);

h.get

Label: 'Label'

Radius: 20

h.addproperty('Position');

h.set('Position', [200 120]);

h.get

Label: 'Label'

Radius: 20

Position: [200 120]

h.deleteproperty('Position');

h.get

Label: 'Label'

Radius: 20

See also COM/addproperty, COM/get, COM/set

<COM/delete> - Delete a COM object.

DELETE Delete a COM object.

DELETE(OBJ) releases all interfaces derived from the specified

COM server or control, and then deletes the server or control itself.

This is different from releasing an interface, which releases and

invalidates only that interface.

Equivalent syntax is

OBJ.DELETE

See also COM/release

<COM/release> - Release a COM interface.

RELEASE Release a COM interface.

RELEASE(OBJ) releases the interface and all resources used by the

interface. Once an interface has been released, it is no longer valid.

Subsequent operations on the MATLAB object that represents that

interface will result in errors. Releasing the interface does not delete

the COM object itself (see delete), since other interfaces on that object

may still be active

See also COM/delete.

<COM/move> - Move and/or resize an ActiveX control in its parent window.

MOVE Move and/or resize an ActiveX control in its parent window.

POSITION = MOVE(OBJ) returns the current position.

Equivalent syntax is

P = OBJ.MOVE

MOVE(OBJ, POSITION) moves the control OBJ to a new position in the

parent figure window. The position argument is a four-element vector

specifying the position and size of the control in the window. The

elements of the vector are [x, y, width, height] where x and y are the

distances, in pixels, from the left window border and bottom window

border respectively.

Equivalent syntax is

P = OBJ.MOVE(POSITION)

Example:

f = figure('Position', [100 100 200 200]);

h = actxcontrol('mwsamp.mwsampctrl.1', [0 0 200 200], f);

pos = h.move([50 50 200 200])

pos =

50 50 200 200

See also COM/ACTXCONTROL, COM/ACTXCONTROLSELECT

<COM/propedit> - Invoke the property page.

PROPEDIT displays the property page.

PROPEDIT(OBJ) displays the property page of an ActiveX control.

See also COM/invoke.

<COM/save> - Serialize a COM object to a file.

SAVE Serialize a COM object to a file.

SAVE(OBJ, FILENAME) saves the COM control object OBJ to the file

specified in the string FILENAME.

Equivalent syntax is

S = OBJ.SAVE(FILENAME)

See also COM/load

<COM/load> - Initialize a COM object from a file.

LOAD Initialize a COM object from a file.

LOAD(OBJ, FILENAME) Initializes the COM object OBJ from file FILENAME.

FILENAME is the full pathname of the serialized data. The file must

have been created previously by serializing an instance of the same

object using the SAVE function.

Equivalent syntax is

S = OBJ.LOAD(FILENAME)

See also COM/save

COM Sample code

<mwsamp> - Sample Activex control creation.

MWSAMP Sample script to create ActiveX object.

Script to create the MATLAB sample ActiveX control. The script

sets the 'Label' and 'Radius' properties and invokes the 'Redraw'

method.

SAMPEV is the event handler for this control. The only event

fired by the control is 'Click', which is fired when the user

clicks on the control with the mouse. The event handler displays

a text message in the MATLAB command window when the event is fired.

See also sampev, actxcontrol.

<sampev> - Sample event handler for ActiveX server.

SAMPEV Sample event handle for ActiveX control.

SAMPEV is a sample event handler function for the example sample

control (version 2) that is shipped with MATLAB. The events

fired from this control (progID: mwsamp.mwsampctrl.2) are

Click, dblClick and MouseDown. The event handler displays

a text message in the MATLAB command window when the event is fired.

See also mwsamp, actxcontrol.

Соседние файлы в папке Библиотеки Matlab