Specifications
2 MATLAB GUIs
2-10
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.
•
User-specified – 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.
User-specified resizing requires you to write a callback routine
that recalculate 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, and uicontrols should be 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 does not require a callback routine.
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.