MATLAB Creating Graphical User Interfaces

(ff) #1
using the default figure Units of pixels does not produce a UI that looks the same on
all platforms.

For this reason, GUIDE defaults the Units property for the figure to characters.

System-Dependent Units

Character units are defined by characters from the default system font. The width of a
character unit equals the width of the letter x in the system font. The height of a
character unit is the distance between the baselines of two lines of text. Note that
character units are not square.

Units and Resize Behavior

The default Units property might change if you change the resize behavior using Tools
> GUI Options. This table lists the default units for each of the Resize behavior options.

Resize Behavior Default Units for Figure Default Units for Other
Components
Non-resizable characters characters
Proportional characters normalized
Other (Use
SizeChangedFcn)

characters characters

At, times it might be convenient to use other units, such as inches or centimeters.
However, to preserve the look of your UI on different computers, remember to change the
figure Units property back to the default units after completing your layout calculations.

For more information on the resize behavior options, see “GUIDE Options” on page 5-10.

NoteGUIDE does not automatically adjust component units if you modify the figure's
Resize property programmatically or in the Property Inspector.

6 Lay Out a UI Using GUIDE

Free download pdf