MATLAB Creating Graphical User Interfaces

(Barry) #1
Create Toolbars for GUIDE UIs

context menu. The Icon Editor opens with the tool’s CData loaded into it. For information
about editing icons, see “Use the Icon Editor” on page 6-116.


Edit Toolbar Properties


If you click an empty part of the toolbar or click the Toolbar Properties tab, you can
edit two of its properties:



  • Tag — The internal name for the toolbar

  • Visible — Whether the toolbar is displayed in your UI


The Tag property is initially set to uitoolbar1. The Visible property is set to on.
When on, the Visible property causes the toolbar to be displayed on the UI regardless
of the setting of the figure’s Toolbar property. If you want to toggle a custom toolbar as
you can built-in ones (from the View menu), you can create a menu item, a check box, or
other control to control its Visible property.


To access nearly all the properties for the toolbar in the Property Inspector, click More
Properties.


Test Your Toolbar


To try out your toolbar, click the Run button in the Layout Editor. The software asks if
you want to save changes to its .fig file first.


Remove a Toolbar


You can remove a toolbar completely—destroying it—from the Toolbar Editor, leaving
your UI without a toolbar (other than the figure toolbar, which is not visible by default).
The are two ways to remove a toolbar:



  • Click the Remove button on the right end of the toolbar.

  • Right-click a blank area on the toolbar and select Remove Toolbar from the context
    menu.


If you remove all the individual tools in the ways shown in “Remove Tools” on page
6-114 without removing the toolbar itself, your UI will contain an empty toolbar.


Close the Toolbar Editor


You can close the Toolbar Editor window in two ways:



  • Press the OK button.

Free download pdf