User`s guide
A GUI That Manages List Data
buttons that migrate items higher or lower in the list box. It disables the Move
Up button when the selected item is at the top of the list, and disables the
Move Down button when the selected item is at the bottom of the list. Then
it copies the current list selection into the edit text box, replacing whatever
was there. Finally, it sets the “dirty” flag in the figure’s application data to
indicate that the G UI’s data or state has changed. See “List Master Utility
Functions” on page 15-48 for details.
Finally, having set up the GUI to receive data,
lmnew enables the File >
Import list menu option and its subitem.
List Master Menu Callbacks
List Master has seven menu items and three submenu items. A fourth
submenu item, Import list from file,existsonlyasastubprovidedasan
exercise for the reader to implement. The menu items and their callbacks are
listed in the table in the section “List Master Main Program” on page 15-42.
To obtain user inpu t, the menu callbacks ca ll built-in MATLAB GUI functions.
Those used are
•
errordlg (Open, Export list to workspace, Export list to file)
•
inputdlg (New, Export list to workspace)
•
listdlg (Import list)
•
questdlg (Export list to workspace, Quit)
•
uigetfile (Open)
•
uiputfile (Export list to file, Save as )
All are modal dialogs.
The New menu item has two modes of operation, depending on whether the
GUI is blank or already contains a list box and associated controls. The
lmnew
callback determines which is the case by parsing the figure’s Name property:
• If the GUI is blank, the name is “ListMaster”.
• if it already contains a list, the name is “Listmaster-” followed by a list
name.
15-45