
Creating Toolbars
6-61
Creating Toolbars
GUIDE provides no tool to enable you do add a toolbar. However, you can add
a toolbar by adding code to the opening function.
See “Initialization Callbacks” on page 8-15 for information about the opening
function, and the
uitoolbar, uipushtool, and uitoggletool reference pages
for information and examples.
Add the following code to the GUI’s opening function to produce the toolbar
shown. The example creates a toolbar (
uitoolbar) and places a toggle tool
(
uitoggletool) on it.
ht = uitoolbar(hObject)
a(:,:,1) = rand(20);
a(:,:,2) = rand(20);
a(:,:,3) = rand(20);
htt = uitoggletool(ht,'CData',a,'TooltipString','Hello')
In the opening function, hObject is an input argument that holds the figure
handle. The
CData property enables you to display a truecolor image on the
toggle tool.
Commenti su questo manuale