MATLAB Creating Graphical User Interfaces

(Barry) #1
Add Components to the GUIDE Layout Area

TipYou need to move controls with the mouse to register them with the surrounding
panel or button group, even if only by a pixel or two. Selecting them and using arrow
keys to move them does not accomplish this. Use the Object Browser to verify that
controls are properly nested.

See “Panels and Button Groups” on page 6-44 for more information on how to
incorporate panels and button groups into a UI.


Assign an Identifier to Each Component


Use the Tag property to assign each component a unique meaningful string identifier.


When you place a component in the layout area, GUIDE assigns a default value to the
Tag property. Before saving the UI, replace this value with a string that reflects the role
of the component in the UI.


The string value you assign Tag is used by code to identify the component and must be
unique in the UI. To set Tag:


(^1) Select View > Property Inspector or click the Property Inspector button.
2 In the layout area, select the component for which you want to set Tag.
3 In the Property Inspector, select Tag and then replace the value with the string you
want to use as the identifier. In the following figure, Tag is set to mybutton.
User Interface Controls
User interface controls include push buttons, toggle buttons, sliders, radio buttons, edit
text controls, static text controls, pop-up menus, check boxes, and list boxes.

Free download pdf