Main Content

Manage Resizable Apps in App Designer

Apps you create in App Designer are resizable by default. The components reposition and resize automatically as the user changes the size of the window at run-time. TheAutoResizeChildrenproperty controls this automatic resize behavior. By default, App Designer enables this property for the UI figure and all its child containers such as panels and tabs. To set theAutoResizeChildrenproperty of a child container to a different value, set the value for the child container after setting the value for the parent.

When theAutoResizeChildrenproperty is enabled for a container, MATLAB®manages the size and position of only the immediate children in the container. Components in nested containers are managed by theAutoResizeChildrenproperty of their immediate parent. To ensure that the alignment of components relative to one another (like a grouping of buttons) is preserved when your app is resized, parent the grouping of components to a panel, instead of directly to the figure.

Resizing Graphics Objects with Normalized Position Units

When graphics objects, like axes or charts, use normalized position units and are the child of a resizeable container, certain properties of the graphics object are affected after the parent container is resized. For example, if axes or charts use a value of'normalized'for theUnitsproperty and are parented to a container with theAutoResizeChildrenproperty set to'on', then:

  • The value of theOuterPositionproperty for the axes or chart changes when the app is resized.

  • The axes or chart does not shrink smaller than a minimum size when the app is resized.

If you want to avoid either of these behaviors, set theAutoResizeChildrenproperty of the container to'off'.

Alternatives to Default Auto-Resize Behaviors

如果你想要更多的灵活性aut如何你的应用omatically resizes, use grid layout managers or the auto-reflow options in App Designer instead of theAutoResizeChildrenproperty. For more information about these options, see:

If the resize behaviors supported byAutoResizeChildren, grid layout managers, or auto-reflow options are not the behaviors you want, then you can create custom resize behaviors by writing aSizeChangedFcncallback function for the container. For more information, seeManage App Resize Behavior Programmatically.

See Also

Related Topics