Creating Graphical User Interfaces |
Some Commonly Used Properties
As examples, this section describes four important and commonly used properties of user interface control components: Tag
, Callback
, String
, and Value
.
Tag
The Tag
property is an identifier for the component. 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 associated with the Callback
property (e.g., pushbutton1_Callback
). You should change the Tag
property to a more descriptive name, so that you can more easily identify the component's callback in the M-file. For example, if you add a push button that closes the GUI, you might set its tag to close_button
.
GUIDE uses the Tag
property to
close_button_Callback
) when you run or save the GUI
handles
structure containing the handle of the object (e.g., handles.close_button
)
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.
|
Callback
The Callback
property specifies the callback that is executed in the GUI M-file when a user activates the component.
String
The String
property contains text for the component. The following are examples:
String
text is displayed on or next to the component.
String
property contains a list of strings that is displayed in the text box. When a user edits the text, the String
property is updated.
Value
The Value
property contains a numerical value for the component, which must lie in the range specified by the Max
and M
in properties. The following are examples:
Max
and Min
are set to 1
and 0
, respectively, by default. The Value
property is set to 1
when the radio button or check box is selected, and 0
when it is cleared.
Value
is set to a number between Max
and Min
corresponding to the location of the slider button.
What Properties Do I Need to Set? | Setting Properties for Some Specific Components |
© 1994-2005 The MathWorks, Inc.