MATLAB Creating Graphical User Interfaces

(ff) #1

Design Cross-Platform UIs in GUIDE


In this section...
“Default System Font” on page 6-106
“Standard Background Color” on page 6-107
“Cross-Platform Compatible Units” on page 6-107

Default System Font


By default, user interface controls (uicontrols) use the default font for the platform on
which they are running. For example, when displaying your UI on PCs, uicontrols use MS
San Serif. When your program runs on a different platform, it uses that computer's
default font. This provides a consistent look with respect to your UI and other
applications.

If you have set the FontName property to a named font and want to return to the default
value, you can set the property to default. This ensures that the software uses the
system default at run-time.

You can use the Property Inspector to set this property:

As an alternative, use the set command to set the property in the code file. For example,
if there is a push button in your UI and its handle is stored in the pushbutton1 field of
the handles structure, then the statement

set(handles.pushbutton1,'FontName','default')

6 Lay Out a UI Using GUIDE

Free download pdf