MATLAB Creating Graphical User Interfaces

(Barry) #1

10 Lay Out a Programmatic UI


Adjust Programmatic UI Layouts Interactively


In this section...
“Set Positions of Components Interactively” on page 10- 41
“Align Components” on page 10- 51
“Set Colors Interactively” on page 10- 58
“Set Font Characteristics Interactively” on page 10- 59

Laying out a programmatic UI can take time and involves many small steps. For
example, you must position components manually—often several times—to place them
exactly where you want them to be. Establishing final settings for other properties and
coding statements for them also takes time. You can reduce the effort involved by taking
advantage of built-in MATLAB tools to establish values for component properties. The
following sections describe some of the tools.

Mode or Tool Use it to Commands
Plot edit mode Interactively edit and annotate
plots

plotedit

Property Editor Edit graphical properties of
objects

propedit, propertyeditor

Property
Inspector

Interactively display and edit
most object properties

inspect

Align Distribute
Tool

Align and distribute components
with respect to one another

align

Color Selector Choose a color from a palette of
colors and obtain its value

uisetcolor

Font Selector Preview character font, style, and
size and choose values for them

uisetfont

Some of these tools return property values, while others let you edit properties
interactively without returning their values. In particular, the Property Inspector lets
you interactively set almost any object property. You then can copy property values and
paste them into the Command Window or a code file. However, when you capture vector-
valued properties, such as Color or Position, the Inspector only lets you copy values one
number at a time.
Free download pdf