Documentation Center

  • Trials
  • Product Updates

uistack

Reorder visual stacking order of objects

Syntax

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

Description

uistack(h) raises the visual stacking order of the objects specified by the handles in h by one level (step of 1). All handles in h must have the same parent.

uistack(h,stackopt) moves the objects specified by h in the stacking order, where stackopt is one of the following:

  • '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 the objects specified by h up or down the number of levels specified by step.

    Note   In a GUI, axes objects are always at a lower level than uicontrol objects. You cannot stack an axes object on top of a uicontrol object.

See Set Tab Order in a Programmatic GUI in the MATLAB® documentation for information about changing the tab order.

Examples

Create three stacked push buttons, and then use uistack to change the stacking order. Initially, the Ready push button appears on top.

fh=figure;
pb1 = uicontrol('Parent', fh,'String','Go');
pb2 = uicontrol('Parent', fh,'String','Set');
pb3 = uicontrol('Parent', fh,'String','Ready');

Use uistack to move the push button that is first in the stacking order of the figure handle fh down two positions.

v = allchild(fh);
uistack(v(1),'down',2);

The Ready push button moves to the bottom of the stack.

Was this topic helpful?