10 Lay Out a Programmatic UI
Property Values Description
displayed on either a push button or
toggle button.
HandleVisibility on, off. Default is on. Determines if an object's handle is
visible in its parent's list of children.
For toolbars and their tools, set
HandleVisibility to off to protect
them from operations not intended
for them.
Separator off, on. Default is off. Draws a dividing line to left of the
push tool or toggle tool
State off, on. Default is off. Toggle tool state. on is the down, or
depressed, position. off is the up, or
raised, position.
TooltipString String Text of the tooltip associated with
the push tool or toggle tool.
For a complete list of properties and for more information about the properties listed
in the table, see the Uitoolbar Properties, Uipushtool Properties, and Uitoggletool
Properties.
Toolbars
The following statements add a toolbar to a figure, and then add a push tool and a toggle
tool to the toolbar. By default, the tools are added to the toolbar, from left to right, in the
order they are created.
% Create the toolbar
fh = figure;
tbh = uitoolbar(fh);
% Add a push tool to the toolbar
a = [.20:.05:0.95];
img1(:,:,1) = repmat(a,16,1)';
img1(:,:,2) = repmat(a,16,1);
img1(:,:,3) = repmat(flipdim(a,2),16,1);
pth = uipushtool(tbh,'CData',img1,...
'TooltipString','My push tool',...
'HandleVisibility','off');