Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

uistack

Reorder visual stacking order of objects

Syntax

uistack(h)
uistack(h,stackopt)
uistack(h,stackopt,step)

Description

uistack(h) shifts object h up one level within the visual stacking order of UI objects. You can also specify h to be a vector of UI objects. When h is a vector, the objects stack according to their order in the vector. All items in the stack must share the same parent.

uistack(h,stackopt) moves the object h to another place in the stack according to stackopt:

  • 'up' – moves h up one position in the stacking order

  • 'down' – moves h down one position in the stacking order

  • 'top' – moves h to the top of the current stack

  • 'bottom' – moves h to the bottom of the current stack

uistack(h,stackopt,step) moves object h up or down the number of levels specified by step. For example, uistack(h,'up',2) moves h up two levels in the stack.

Examples

collapse all

Create a figure containing a uipanel and a child axes. Then, plot a sine function in the axes.

f = figure;
p1 = uipanel(f,'Position',[.10 .10 .80 .80],...
            'Tag','Panel with Sine Plot');
ax1 = axes('Parent',p1,'Position',[.1 .1 .8 .8]);

theta = -3*pi:pi/64:3*pi;
y1 = sin(theta);
plot(ax1,theta,y1);

In the same figure, create a second uipanel with a child axes. Then, create a surface plot in this axes.

p2 = uipanel(f,'Position',[.10 .10 .80 .80],...
            'Tag','Panel with Surface Plot');
ax2 = axes('Parent',p2,'Position',[.1 .1 .8 .8]);
Z  = peaks(25);
surf(ax2,Z);

Next, move the uipanel containing the sine function to the top.

uistack(p1,'top');
f.Children
ans = 

  2x1 Panel array:

  Panel    (Panel with Sine Plot)
  Panel    (Panel with Surface Plot)

Now, move the other uipanel to the top.

uistack(p2,'top');
f.Children
ans = 

  2x1 Panel array:

  Panel    (Panel with Surface Plot)
  Panel    (Panel with Sine Plot)

More About

collapse all

Visual Stacking Order

The order of overlapping components in a UI window. Components on top of the stack appear in front of components that are lower in the stack.

Introduced before R2006a

Was this topic helpful?