User`s guide
15 Examples of GUIs Created Programmatically
Note Use application data to communicate information betw een uicontrols
and other objects in GUIs you create. You can assign application data to any
Handle Graphics object. The data can be of any type, and is separate from
that of other objects. Application data is not an object property on which
set
or get operates; you must use function s etappdata to store it and function
getappdata to retrieve it. See the section “Application Data” on page 13-6
for more information.
Add an “Import from File” Option to List Master
If you want to round out List M aster’s capabilities, try activating the
File > Import list > from file menu item. You can a dd this feature yourself
by removing comments from lines 106-108 (enabling a File > Import
list > from file menu item) and adding your own code to the callback. For
related code that you can use as a starting point, see the
lmfileexport
callback for File > Export list > to file.
Add a “Rename List” Option to List Master
When you import data to a list, you replace the entire contents of the list with
the imported text. If the content of the new list is very different, you might
want to give a new name to the list. (The list name appears above the list
box). Consider adding a menu item o r context menu item, such as Rename
list. The callback f or this item could
• Call
lm_get_list_name to get a name from the user (perhaps after
modifying it to let the caller specify the prompt string.)
• Do nothing if the user cancels the dialog.
• Obtain the handle of the uipanel with tag
'lmtitlepaneltag' (as described
in “Identify Component Handles” on page 15-47).
• Set the
Title property of the u ipanel to the string that the user just
specif ied.
After renaming the list, the user can save the GUI to a new FIG-file with
Save as. If the GUI had been saved previously, saving it to a new file
preserves that version of the GUI with its original name and contents.
15-50