MATLAB Creating Graphical User Interfaces

(Barry) #1

6 Lay Out a UI Using GUIDE



  • Drag a tool to a new position.

  • Select a tool in the toolbar and click one of the arrow buttons below the right side of
    the toolbar.


If a tool has a separator to its left, the separator moves with the tool.

Remove Tools

You can remove tools from the toolbar in three ways:


  • Select a tool and press the Delete key.

  • Select a tool and click the Delete button on the UI.

  • Right-click a tool and select Delete from the context menu.


You cannot undo any of these actions.

Edit a Tool’s Properties

You edit the appearance and behavior of the currently selected tool using the Tool
Properties pane, which includes controls for setting the most commonly used tool
properties:


  • CData — The tool’s icon

  • Tag — The internal name for the tool

  • Enable — Whether users can click the tool

  • Separator — A bar to the left of the icon for setting off and grouping tools

  • Clicked Callback — The function called when users click the tool

  • Off Callback (uitoggletool only) — The function called when the tool is put in the off
    state

  • On Callback (uitoggletool only) — The function called when the tool is put in the on
    state


See “Write Callbacks Using the GUIDE Workflow” on page 8-2 for details on
programming the tool callbacks. You can also access these and other properties of the
selected tool with the Property Inspector. To open the Property Inspector, click the More
Properties button on the Tool Properties pane.

Edit Tool Icons

To edit a selected toolbar icon, click the Edit button in the Tool Properties pane, next
to CData (icon) or right-click the Toolbar Layout and select Edit Icon from the
Free download pdf