Specifications
Renaming Application Files and Tags
2-21
Renaming Application Files and Tags
It is often desirable to use descriptive names for component Tag properties and
callback subfunction names. GUIDE assigns a value to the
Tag property of
every component you insert in your layout (e.g.,
pushbutton1) and then uses
this string to name the callback subfunction (e.g.,
pushbutton1_Callback).
It is generally a good practice to select the tags and filenames before activating
or saving your GUI for the first time.
Using Save As
When you select Save As from the Layout Editor File menu, GUIDE also
renames the application M-file and resets the
Callback properties to properly
execute the callbacks.
Note Since GUIDE uses the Tag property to name functions and structure
fields, the
Tag you select must be a valid MATLAB variable name. Use
isvarname to determine if the string you want to use is valid.
Getting Everything Right
If you make changes after GUIDE has generated the M-file and FIG-file, you
must ensure that your code incorporates these changes. This section describes:
•Changing component tag properties
•Changing the name of callback subfunctions
•Changing the name of the M-file and FIG-file
Changing Component Tag Properties
Guide automatically assigns a string to the uicontrol Tag property and uses
this string to:
•Construct the name of the generated callback subfunctions (e.g.,
tag_Callback)
•Add a field to the
handles structure containing the handle of the object (e.g.,
handles.tag)