MATLAB Creating Graphical User Interfaces

(Barry) #1
Create Toolbars for Programmatic UIs

Create Toolbars for Programmatic UIs


In this section...
“Use the uitoolbar Function” on page 10- 79
“Commonly Used Properties” on page 10- 79
“Toolbars” on page 10- 80
“Display and Modify the Standard Toolbar” on page 10- 83

Use the uitoolbar Function


Use the uitoolbar function to add a custom toolbar to your UI. Use the uipushtool
and uitoggletool functions to add push tools and toggle tools to a toolbar. A push tool
functions as a push button. A toggle tool functions as a toggle button. You can add push
tools and toggle tools to the standard toolbar or to a custom toolbar.

Syntaxes for the uitoolbar, uipushtool, and uitoggletool functions include the
following:

tbh = uitoolbar(fh,'PropertyName',PropertyValue,...)
pth = uipushtool(tnh,'PropertyName',PropertyValue,...)
tth = uitoggletool(tbh,'PropertyName',PropertyValue,...)

The output arguments, tbh, pth, and tth are the handles, respectively, of the resulting
toolbar, push tool, and toggle tool. See the uitoolbar, uipushtool, and uitoggletool
reference pages for other valid syntaxes.

Subsequent topics describe commonly used properties of toolbars and toolbar tools, offer
a simple example, and discuss use of the MATLAB standard toolbar:

Commonly Used Properties


The most commonly used properties needed to describe a toolbar and its tools are shown
in the following table.

Property Values Description
CData 3-D array of values
between 0.0 and 1.0

n-by-m-by-3 array of RGB values
that defines a truecolor image
Free download pdf