Lists of Items in a Programmatic UI
Here is the code that calculates the initial position of the UI window:
su = get(groot,'Units');
set(groot,'Units','pixels')
scnsize = get(groot,'ScreenSize');
scnsize(3) = min(scnsize(3),1280); % Limit superwide screens
figx = 264; figy = 356; % Default (resizable) size
pos = [scnsize(3)/2-figx/2 scnsize(4)/2-figy/2 figx figy];
...
set(groot,'Units',su) % Restore default root screen units
The Open menu option only opens figures created by listmaster.m. Every List Master
figure has its Tag set to lmfigtag. When the program opens a FIG-file, it uses this
property value to determine that figure is a List Master UI. If the Tag has any other
value, the program closes the figure and displays an error.
The Quit menu option closes the UI 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 UI has no controls other than a menu, the user can select File >
Save as to save a blank UI as a FIG-file. Opening the saved FIG-file has the same result
as executing the listmaster function.
The user can create a new list by selecting File > New. This executes setup functions
that populate the UI with uicontrols. The lmnew callback manages these tasks, calling
setup functions in the following sequence. The three setup functions are listed and
described below.
Setup Function How Used
lm_get_list_name Calls inputdlg to get name for new list, enforcing size limit
of 32 characters
lm_make_ctrl_btns Creates three push buttons for list navigation and a check
box to control line numbering. This function also loads
listmaster_icons.mat and adds icons to the to push
buttons. Finally, it sets each button’s callback functions.
lm_make_edit_panel Creates a button group with two radio buttons that control
the editing mode. This function also places default text in
the edit text box.