Specifications
3 Laying Out GUIs and Setting Properties
3-26
Resize Behavior
You can control whether users can resize the figure window containing your
GUI and how MATLAB handles resizing. GUIDE provides three options:
•
Non-resizable — Users cannot change the window size (default).
•
Proportional — MATLAB automatically rescales the components in the
GUI in proportion to the new figure window size.
•
Other (Use ResizeFcn) — Program the GUI to behave in a certain way when
users resize the figure window.
The first two approaches simply set properties appropriately and require no
other action.
Other (Use ResizeFcn) requires you to write a callback routine
that recalculates sizes and positions of the components based on the new figure
size. The following sections discuss each approach.
Making Your GUI Nonresizable
Certain types of GUIs are typically nonresizable. Warning and simple question
dialog boxes, particularly modal windows, are usually not resizable. After a
simple interaction, users dismiss these GUIs so changing their size is not
necessary.
Property Settings. GUIDE sets the following properties to create nonresizable
GUIs:
•
Units properties of the figure, axes, user interface controls, panels, and
button groups are set to
characters (the Layout Editor default) so the GUI
displays at the correct size on different computers.
•
Resize figure property is set to off.
•
ResizeFcn figure property is left unset.
Allowing Proportional GUI Resizing
Use this approach if you want to allow users to resize the GUI and are satisfied
with a behavior that simply scales each component’s size and relative position
in proportion to the new figure size. Note that the font size of component labels
does not resize and, if the size is reduced enough, these labels may become
unreadable. This approach works well with simple GUI tools and dialog boxes
that apply settings without closing.