User`s guide
12 Code a Programmatic GUI
Or ganize a Programmatic GUI File
After laying out your GUI, program its behavior. This chapter addresses the
programming of GUIs created programmatically. Specifically, it discusses
data creation, GUI initialization, and the use of callbacks to control GUI
behavior.
The following ordered list show s these topics within the organization of the
typical GUI code file.
1 Comments display ed in response to the MATLAB help command.
2 Initialization tasks such as data creation and any processing for
constructing the components. See “Initialize a Programmatic GUI” on page
12-3 for information.
3 Construct
ion of figure and components. See Chapter 11, “Lay Out a
Programma
tic GUI” for information.
4 Initialization tasks that require the components to exist, and output return.
See “Initialize a Programmatic GUI” on page 12-3 for information.
5 Callbacks for the components. Callbacks are the routines that execute in
response to user-generated events such as mouse clicks and key strokes.
See“WriteCodeforCallbacks”onpage12-7and“Examples:ProgramGUI
Components” on page 12-20 for information.
6 Utilit
y functions.
Discu
ssions in this chapter assum e the use of nested functions. For
infor
mation about using nested functions, see “Nested Functions”.
Note
MATLAB software provides a selection of standard dialog boxes
that
you can create w ith a single function call. For an example, see the
docu
mentation for
msgbox, which also provides links to functions that create
spe
cialized predefined dialog boxes.
12-2