Control push tool appearance and behavior
Push tools are push buttons that appear in the tool bar at the top of a figure.
uipushtool function creates a push button in a tool bar and sets any
required properties before displaying it. By changing property values, you can modify certain
aspects of its appearance and behavior. Use dot notation to refer to a specific object and
pt = uipushtool; pt.Separator = 'on';
Icon — Icon source or file
'' (default) | character vector | string scalar |
n-by-3 truecolor image array
Icon source or file, specified as a character vector, string scalar, or an
n-by-3 truecolor image array. If you
specify a character vector or string scalar, it can be an image file name on the
MATLAB® path or a full path to an image file. If you plan to share your app with
others, put the image file on the MATLAB path to facilitate app packaging. Supported image formats include JPEG,
PNG, GIF, and SVG.
If you specify an
n-by-3 array, it is
interpreted as a truecolor image array. For more information about truecolor image
arrays, see Image Types.
If the image you specify is larger than 16-by-16 pixels, then the
Icon property scales the image down so that the entire image fits within the tool. If the image you specify is smaller than 16-by-16 pixels, it is not scaled up to fit the available space.
Icon property is supported only in App Designer and
uifigure-based apps. If the
CData properties are both set, then the
CData property is ignored.
'icon.png' specifies an image file on the MATLAB path.
'C:\Documents\icon.png' specifies a full path to an image file.
Tooltip — Tooltip
character vector | string scalar | categorical array
Tooltip, specified as a character vector, string scalar, or categorical array. Use this property to display a message when you hover over the component in the running app. The tooltip does not appear when the component is disabled. If you specify this property as a categorical array, MATLAB uses the values in the array, not the full set of categories.
In figures created with the
uifigure function, push tools and toggle
tools support multiline tooltips. To create a multiline tooltip, use the
sprintf function to insert newline characters (
in your text. For
txt = sprintf('Line 1\nLine 2');
Then set the
Tooltip property to the value returned by
In figures created with the
figure function, push tools and
toggle tools do not support multiline tooltips.
ContextMenu — Context menu
GraphicsPlaceholder array (default) |
Setting this property has no effect on objects of this type.
ClickedCallback — Tool clicked callback
'' (default) | function handle | cell array | character vector
Tool clicked callback, specified as one of these values:
A function handle.
A cell array in which the first element is a function handle. Subsequent elements in the cell array are the arguments to pass to the callback function.
A character vector containing a valid MATLAB expression (not recommended). MATLAB evaluates this expression in the base workspace.
For more information about specifying callback functions as function handles, cell arrays, or character vectors, see Specify a Callback Function.
Callback Execution Control
HandleVisibility — Visibility of object handle
'on' (default) |
Visibility of object handle, specified as
This property controls the visibility of the object in its parent's list of children. When an
object is not visible in its parent's list of children, it is not returned by functions
that obtain objects by searching the object hierarchy or querying properties. These
HandleVisibility property also controls the visibility of the
object’s handle in the parent figure's
Objects are valid even if they are not visible. If you can access an object, you can set
and get its properties, and pass it to any function that operates on
|The object handle is always visible.|
|The object handle is visible from within callbacks or functions invoked by callbacks, but not from within functions invoked from the command line. This option blocks access to the object at the command line, but allows callback functions to access it.|
|The object handle is invisible at all times. This option is
useful for preventing unintended changes to the UI by another
function. Set the |
Type — Type of graphics object
This property is read-only.
Type of graphics object, returned as
Version HistoryIntroduced before R2006a
R2020b: Specify custom icons
In apps created in App Designer and
uifigure-based apps, to add a
custom icon to a push tool, set the
Icon property. You can specify the
Icon property as an image file or an
n-by-3 truecolor array.
Icon property is recommended over the