uipushtool
Creates a tool button in a uitoolbar.
Syntax
handle = uipushtool()
handle = uipushtool(parent)
handle = uipushtool(parent, property, value, ...)
Inputs
- parent
- Handle of the uitoolbar parent. If there is no parent specified, the parent will be a default uitoolbar in the current figure, gcf.
- property, value
-
- clickedcallback
- Callback function triggered when the handle is clicked.
- createfcn
- Function triggered when handle is created.
- deletefcn
- Function triggered when handle is deleted.
- enable
- Specifies if handle is enabled. Valid values are on(default) and off.
- iconpath
- Path to the icon on handle.
- interruptible
- Specifies if clickedcallback can be interrupted by clicking on the Stop button in the user interface. Valid values are off (default) and on.
- keypressfcn
- Function triggered when there a key is pressed on handle.
- parent
- Specifies the parent (uitabgroup).
- separator
- Specifies is a separator needs to be added after handle on the parent uitoolbar. Valid values are off (default) and on.
- tag
- User-defined string to tag handle.
- tooltipstring
- Tooltip.
- userdata
- User-defined numerical data.
- value
- User-defined scalar data.
- visible
- Specifies if handle is visible. Valid values are on(default) and off.
Outputs
- handle
- Handle of the uipushtool created.
Example
Creates a toolbar with tool buttons in a uipanel:
% Callback function:
function pushtool3_callback(handle, data, varargin)
printf('Executing callback, handle: [%f]\n', handle);
end
Dialog = figure('units', 'pixels', 'position', [0 0 700 474] ...
, 'name','Dialog', 'windowstyle','undocked');
uiPanel = uipanel('parent', Dialog, 'units','normalized', 'position',[0.07 0.24 0.89 0.69], 'title','Test');
toolbar = uitoolbar(uiPanel);
% uipushtool with an icon
pushtool1 = uipushtool(toolbar, 'iconpath', 'msfolder.png');
% uipushtool with a separator
pushtool2 = uipushtool(toolbar, 'iconpath', 'TableView-16.png', 'separator', 'on');
% uipushtool with a callback
pushtool3 = uipushtool(toolbar, 'iconpath', 'mslist.png', 'clickedcallback','pushtool3_callback');