14 Examples of UIs Created Programmatically
Likewise, specifying the figure handle to findobj assures that only one list box handle
is returned, regardless of how many List Master instances are open at the same time.
List Master Utility Functions
Certain callbacks rely on four small utility functions that are listed and described in this
table.
Utility Function How Used
number_list Called to generate line numbers whenever a list
updates and line numbering is on
guidirty Sets the Boolean dirty flag in the figure's application
data to true or false to indicate difference from saved
version
isguidirty Returns logical state of the figure's dirty flag
make_list_output_name Converts the name of a list (obtained from the figure
Name property) into a valid MATLAB identifier, which
serves as a default when saving the UI or exporting its
data
List numbering works by adding five spaces before each list entry, then substituting
numerals for characters 3, 2, and 1 of these blanks (as needed to display the digits) and
placing a period in character 4. The numbers are stripped off the copy of the current
item that displays in the text edit box, and then prepended again when the edit is
committed (if the Number list check box is selected). This limits the size of lists that
can be numbered to 999 items. You can modify number_list to add characters to the
number field if you want the UI to number lists longer than that.
Note:You should turn off the numbering feature before importing list data if the items
on that list are already numbered. In such cases, the item numbers display in the list,
but moving list items up or down in the list does not renumber them.
The guidirty function sets the figure's application data using setappdata to indicate
that it has been modified, as follows:
function guidirty(fh,yes_no)
% Sets the "Dirty" flag of the figure to true or false