MATLAB Creating Graphical User Interfaces

(ff) #1

Also, it is important to delay the display of the entire UI window until after all the
variables that a SizeChangedFcn callback uses are defined. Doing so can prevent the
SizeChangedFcn callback from returning an error. To delay the display of the window,
set the Visible property of the figure to 'off'. After you define all the variables that
your SizeChangedFcn callback uses, set the Visible property to 'on'.


Manage the Stacking Order of Grouped Components


The default front-to-back order, or stacking order, of components in a UI is as follows:



  • Axes and other graphics objects appear behind other components. UI components and
    containers (uipanels, uibuttongroups, and uitabs) appear in front of them.

  • UI components and containers appear in the order in which you create them. New
    components appear in front of existing components.


You can change the stacking order at any time, but there are some restrictions. Axes and
other graphics objects can stack in any order with respect to each other. However, axes
and other graphics objects cannot stack in front of UI components and containers. They
always appear behind UI components and containers.


You can work around this restriction by grouping graphics objects into separate
containers. Then you can stack those containers in any order. To group a graphics object
into a container, set its Parent property to be that container. For example, you can group
an axes into a uipanel by setting the Parent property of the axes to be the uipanel.


The Children property of a uipanel, uibuttongroup, or uitab lists the child objects inside
the container according to their stacking order.


See Also


Related Examples



  • “DPI-Aware Behavior in MATLAB” on page 9-58


See Also
Free download pdf