This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

move

Move or resize control in parent window

Syntax

V = move(c)
V = move(c,position)

Description

V = move(c) returns a four-element vector indicating the current position of the control.

example

V = move(c,position) moves the control to the position specified by position.

Examples

collapse all

Create an mwsamp control and change its values.

f = figure('Position',[100 100 200 200]);
h = actxcontrol('mwsamp.mwsampctrl.1',[0 0 200 200],f);
pos = move(h,[50 50 200 200])
pos =
    50    50   200   200

Resize the mwsamp control to always be centered in the figure as you resize the figure window.

Create a script resizectrl.m with the following statements.

% Get the new position and size of the figure window
  fpos = get(gcbo,'position');

% Resize the control accordingly
  move(h,[0 0 fpos(3) fpos(4)]);

Create the control and run the script. Notice that the circle moves so that it is always positioned in the center of the window.

f = figure('Position',[100 100 200 200]);
h = actxcontrol('mwsamp.mwsampctrl.1',[0 0 200 200]);
set(f,'ResizeFcn','resizectrl');

Input Arguments

collapse all

COM object, specified as a function handle.

New position in x,y pixel coordinates, specified as integers.

Example: [0 0 200 200]

Output Arguments

collapse all

Position vector, specified as four-element integer vector containing the position and size of the control in the parent figure window. The elements of the vector are [x, y, width, height]. The values x and y are offsets in pixels from the bottom left corner of the figure window to the same corner of the control. The values width and height are the size of the control itself.

Introduced before R2006a