User`s guide
15 Examples of GUIs Created Programmatically
GUI. If the T ag has any other value, the program closes the figure and
displays an error alert.
The Quit menu option closes the GUI after checking whether the figure
needs to be saved. If the contents have changed, its callback (
lmquit)calls
the
lmsaveas callback to give the user an opportunity to save. The figure’s
CloseRequestFcn also uses the lmquit callback when the user clicks the
figure’s close box.
List Master Setup Functions
Although the initial GUI has no controls other than a menu, users can use
File > Save as to save a blank GUI as a FIG-file. Opening the saved FIG-file
has the same result as executing the
listmaster function itself, assuming
that
listmaster.m is currently on the user’s path.
Usually, however, users want to create a list, which they accomplish by
clicking File > New. This executes setup functions that populate the GUI
with uicontrols. The
lmnew callback manages these tasks, calling setup
functions in the following sequence. The three setup functions a re listed and
described below. Click any callback to view it in the MATLAB Editor. The
function opens from the Creating Graphical Interfaces
examples folder.
Setup Fu n ction
How Used
lm_get_list_name
Calls in putd lg to get name for new list, enforcing
size lim it of 32 characters
lm_make_ctrl_btns
Creates three push buttons for list navigation
and a check box to control line numbering, loads
listmaster_icons.mat, applies icons to push
buttons as
CData, and sets controls’ callbacks
lm_make_edit_panel
Creates button group with two radio buttons
controlling editing mode, places a one-line text edit
box below them, and sets callbacks for edit text
control
lmnew then calls enable_updown , which is the c allback for the list box (tagged
lmtablisttag1). It is also called by all other functions that modify the list.
The
enable_updown subfunction sets the Enable property of the pair of push
15-44